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,67 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { Session } from "@supabase/supabase-js";
|
|
4
|
-
import { createContext, useContext, useEffect, useMemo, useState, type PropsWithChildren, type ReactNode } from "react";
|
|
5
|
-
import { useSupabaseBrowser } from "./context";
|
|
6
|
-
|
|
7
|
-
interface SupabaseAuthContextType {
|
|
8
|
-
session: Session | null;
|
|
9
|
-
token: string | undefined;
|
|
10
|
-
isLoading: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const SupabaseAuthContext = createContext<SupabaseAuthContextType | undefined>(undefined);
|
|
14
|
-
|
|
15
|
-
export function useSupabaseAuth() {
|
|
16
|
-
const context = useContext(SupabaseAuthContext);
|
|
17
|
-
if (context === undefined) {
|
|
18
|
-
throw new Error("useSupabaseAuth must be used within a SupabaseAuthProvider");
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function SupabaseAuthProvider({ children }: PropsWithChildren): ReactNode {
|
|
24
|
-
const sb = useSupabaseBrowser();
|
|
25
|
-
const [session, setSession] = useState<Session | null>(null);
|
|
26
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
let mounted = true;
|
|
30
|
-
|
|
31
|
-
async function loadSession() {
|
|
32
|
-
const {
|
|
33
|
-
data: { session },
|
|
34
|
-
} = await sb.auth.getSession();
|
|
35
|
-
if (mounted) {
|
|
36
|
-
setSession(session);
|
|
37
|
-
setIsLoading(false);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
loadSession();
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
data: { subscription },
|
|
44
|
-
} = sb.auth.onAuthStateChange((_event, session) => {
|
|
45
|
-
if (mounted) {
|
|
46
|
-
setSession(session);
|
|
47
|
-
setIsLoading(false);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
mounted = false;
|
|
53
|
-
subscription.unsubscribe();
|
|
54
|
-
};
|
|
55
|
-
}, [sb]);
|
|
56
|
-
|
|
57
|
-
const value = useMemo(
|
|
58
|
-
() => ({
|
|
59
|
-
session,
|
|
60
|
-
token: session?.access_token,
|
|
61
|
-
isLoading,
|
|
62
|
-
}),
|
|
63
|
-
[session, isLoading],
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return <SupabaseAuthContext.Provider value={value}>{children}</SupabaseAuthContext.Provider>;
|
|
67
|
-
}
|
package/src/supabase/context.tsx
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { createBrowserClient } from "@supabase/ssr";
|
|
4
|
-
import { createContext, type ReactNode, useContext, useMemo } from "react";
|
|
5
|
-
import type { TypedSupabaseClient } from "../types";
|
|
6
|
-
import type { Database } from "../types/database.types";
|
|
7
|
-
|
|
8
|
-
let client: TypedSupabaseClient | undefined;
|
|
9
|
-
|
|
10
|
-
export function getSupabaseBrowserClient(url?: string, key?: string): TypedSupabaseClient {
|
|
11
|
-
if (url && key) {
|
|
12
|
-
return createBrowserClient<Database>(url, key);
|
|
13
|
-
}
|
|
14
|
-
if (!client) {
|
|
15
|
-
client = createBrowserClient<Database>(
|
|
16
|
-
// biome-ignore lint/style/noNonNullAssertion: .
|
|
17
|
-
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
18
|
-
// biome-ignore lint/style/noNonNullAssertion: .
|
|
19
|
-
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
// biome-ignore lint/style/noNonNullAssertion: 已经确保了初始化
|
|
23
|
-
return client!;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const SupabaseContext = createContext<TypedSupabaseClient | undefined>(undefined);
|
|
27
|
-
|
|
28
|
-
export function useSupabaseContext(): TypedSupabaseClient {
|
|
29
|
-
const ctx = useContext(SupabaseContext);
|
|
30
|
-
if (!ctx) {
|
|
31
|
-
throw new Error("useSupabaseContext must be used within a SupabaseProvider");
|
|
32
|
-
}
|
|
33
|
-
return ctx;
|
|
34
|
-
}
|
|
35
|
-
export const useSupabaseBrowser = useSupabaseContext;
|
|
36
|
-
|
|
37
|
-
interface SupabaseClientProviderProps {
|
|
38
|
-
children: ReactNode;
|
|
39
|
-
publicKey?: string;
|
|
40
|
-
url?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const SupabaseClientProvider = ({ children, publicKey, url }: SupabaseClientProviderProps): ReactNode => {
|
|
44
|
-
const client = useMemo(() => getSupabaseBrowserClient(url, publicKey), [url, publicKey]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<SupabaseContext.Provider value={client}>
|
|
48
|
-
{children}
|
|
49
|
-
</SupabaseContext.Provider>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 游标分页工具函数
|
|
3
|
-
*
|
|
4
|
-
* 提供类型安全的游标分页支持,配合 react-query 的 useInfiniteQuery 使用。
|
|
5
|
-
*
|
|
6
|
-
* @module mtmsdk/supabase/cursor-pagination
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 游标类型定义
|
|
11
|
-
*
|
|
12
|
-
* 使用复合游标 (updated_at + id) 确保分页的唯一性和稳定性
|
|
13
|
-
*/
|
|
14
|
-
export interface CursorPagination {
|
|
15
|
-
cursor: string | null; // ISO 时间戳字符串, 如 "2026-01-20T08:00:00Z"
|
|
16
|
-
cursorId: string | null; // UUID 字符串
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 从数据列表中提取下一页游标
|
|
21
|
-
*
|
|
22
|
-
* @param items - 当前页的数据列表
|
|
23
|
-
* @param limit - 每页数量
|
|
24
|
-
* @param cursorField - 游标字段名 (默认 "updated_at")
|
|
25
|
-
* @param idField - ID 字段名 (默认 "id")
|
|
26
|
-
* @returns 下一页游标, 如果没有更多数据则返回 undefined
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```tsx
|
|
30
|
-
* const { data, fetchNextPage, hasNextPage } = useInfiniteQuery({
|
|
31
|
-
* queryKey: ['projects', kw],
|
|
32
|
-
* queryFn: async ({ pageParam }) => {
|
|
33
|
-
* const { data } = await sb.rpc('audit_project_list_cursor', {
|
|
34
|
-
* p_cursor: pageParam?.cursor ?? null,
|
|
35
|
-
* p_cursor_id: pageParam?.cursorId ?? null,
|
|
36
|
-
* p_limit: 20,
|
|
37
|
-
* p_kw: kw
|
|
38
|
-
* });
|
|
39
|
-
* return data ?? [];
|
|
40
|
-
* },
|
|
41
|
-
* getNextPageParam: (lastPage) => getNextCursor(lastPage, 20),
|
|
42
|
-
* initialPageParam: null as CursorPagination | null
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export function getNextCursor<
|
|
47
|
-
T extends Record<string, unknown>,
|
|
48
|
-
>(
|
|
49
|
-
items: T[] | null | undefined,
|
|
50
|
-
limit: number,
|
|
51
|
-
cursorField: keyof T = "updated_at" as keyof T,
|
|
52
|
-
idField: keyof T = "id" as keyof T,
|
|
53
|
-
): CursorPagination | undefined {
|
|
54
|
-
// 如果数据为空或数量小于 limit,说明已到达最后一页
|
|
55
|
-
if (!items || items.length < limit) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// 获取最后一条记录
|
|
60
|
-
const lastItem = items[items.length - 1];
|
|
61
|
-
if (!lastItem) {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const cursorValue = lastItem[cursorField];
|
|
66
|
-
const idValue = lastItem[idField];
|
|
67
|
-
|
|
68
|
-
// 验证游标值有效性
|
|
69
|
-
if (cursorValue === undefined || cursorValue === null) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
cursor: String(cursorValue),
|
|
75
|
-
cursorId: idValue != null ? String(idValue) : null,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 将所有分页数据合并为单一列表
|
|
81
|
-
*
|
|
82
|
-
* @param pages - useInfiniteQuery 返回的 pages 数组
|
|
83
|
-
* @returns 合并后的扁平数据列表
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```tsx
|
|
87
|
-
* const { data } = useInfiniteQuery({ ... });
|
|
88
|
-
* const allProjects = flattenPages(data?.pages);
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
export function flattenPages<T>(
|
|
92
|
-
pages: T[][] | undefined,
|
|
93
|
-
): T[] {
|
|
94
|
-
if (!pages) return [];
|
|
95
|
-
return pages.flat();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* 无限滚动分页状态
|
|
100
|
-
*/
|
|
101
|
-
export interface InfiniteScrollState {
|
|
102
|
-
isLoading: boolean;
|
|
103
|
-
isFetchingNextPage: boolean;
|
|
104
|
-
hasNextPage: boolean;
|
|
105
|
-
error: Error | null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* 创建 IntersectionObserver 用于无限滚动
|
|
110
|
-
*
|
|
111
|
-
* @param onIntersect - 当元素进入视口时的回调
|
|
112
|
-
* @param options - IntersectionObserver 配置选项
|
|
113
|
-
* @returns cleanup 函数
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```tsx
|
|
117
|
-
* const loadMoreRef = useRef<HTMLDivElement>(null);
|
|
118
|
-
*
|
|
119
|
-
* useEffect(() => {
|
|
120
|
-
* if (!loadMoreRef.current) return;
|
|
121
|
-
* return createInfiniteScrollObserver(
|
|
122
|
-
* () => {
|
|
123
|
-
* if (hasNextPage && !isFetchingNextPage) {
|
|
124
|
-
* fetchNextPage();
|
|
125
|
-
* }
|
|
126
|
-
* },
|
|
127
|
-
* { root: scrollContainerRef.current }
|
|
128
|
-
* )(loadMoreRef.current);
|
|
129
|
-
* }, [hasNextPage, isFetchingNextPage, fetchNextPage]);
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
export function createInfiniteScrollObserver(
|
|
133
|
-
onIntersect: () => void,
|
|
134
|
-
options?: IntersectionObserverInit,
|
|
135
|
-
): (element: Element) => () => void {
|
|
136
|
-
return (element: Element) => {
|
|
137
|
-
const observer = new IntersectionObserver((entries) => {
|
|
138
|
-
const [entry] = entries;
|
|
139
|
-
if (entry?.isIntersecting) {
|
|
140
|
-
onIntersect();
|
|
141
|
-
}
|
|
142
|
-
}, {
|
|
143
|
-
root: null,
|
|
144
|
-
rootMargin: "100px",
|
|
145
|
-
threshold: 0.1,
|
|
146
|
-
...options,
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
observer.observe(element);
|
|
150
|
-
|
|
151
|
-
return () => {
|
|
152
|
-
observer.disconnect();
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
|
|
3
|
-
export const zRpcBaseResponse = z.object({
|
|
4
|
-
error: z.object({
|
|
5
|
-
message: z.string(),
|
|
6
|
-
}),
|
|
7
|
-
});
|
|
8
|
-
export const zBrowserUpsertArgs = z
|
|
9
|
-
.object({
|
|
10
|
-
id: z.string().nullish(),//.transform( x => x ?? undefined ),
|
|
11
|
-
title: z.string(),
|
|
12
|
-
profile_id: z.string().nullish(),//.transform( x => x ?? undefined ),
|
|
13
|
-
description: z.string().nullish()//.transform( x => x ?? undefined ),
|
|
14
|
-
})
|
|
15
|
-
.meta({ ref: "BrowserUpsertArgs" });
|
|
16
|
-
|
|
17
|
-
export const zBrowserListReq = z
|
|
18
|
-
.object({
|
|
19
|
-
kw: z.string().optional(),
|
|
20
|
-
})
|
|
21
|
-
.describe("BrowserListReq")
|
|
22
|
-
.meta({ ref: "BrowserListReq" });
|
|
23
|
-
|
|
24
|
-
const zBrowserItem = z
|
|
25
|
-
.object({
|
|
26
|
-
id: z.string(),
|
|
27
|
-
title: z.string(),
|
|
28
|
-
})
|
|
29
|
-
.describe("BrowserItem")
|
|
30
|
-
.meta({ ref: "BrowserItem" });
|
|
31
|
-
|
|
32
|
-
export const zBrowserData = z
|
|
33
|
-
.object({
|
|
34
|
-
id: z.string(),
|
|
35
|
-
title: z.string(),
|
|
36
|
-
})
|
|
37
|
-
.describe("BrowserData")
|
|
38
|
-
.meta({ ref: "BrowserData" });
|
|
39
|
-
|
|
40
|
-
export const zBrowserListResponse = zRpcBaseResponse
|
|
41
|
-
.extend({
|
|
42
|
-
data: z.array(zBrowserItem),
|
|
43
|
-
})
|
|
44
|
-
// .describe("BrowserProfileResponse")
|
|
45
|
-
.meta({ ref: "BrowserList" });
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
|
|
3
|
-
const singleRowPreprocessor = (val: unknown) => {
|
|
4
|
-
if (Array.isArray(val)) {
|
|
5
|
-
if (val.length === 0) return null;
|
|
6
|
-
if (val.length === 1) return val[0];
|
|
7
|
-
}
|
|
8
|
-
return val;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const domainConfigSchema = z.preprocess(
|
|
12
|
-
singleRowPreprocessor,
|
|
13
|
-
z
|
|
14
|
-
.object({
|
|
15
|
-
primary_domain: z.string().min(1, "主域名不能为空"),
|
|
16
|
-
worker_subdomain_prefix: z.string().optional().default(""),
|
|
17
|
-
})
|
|
18
|
-
.nullable(),
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export const smsProviderConfigSchema = z.object({
|
|
23
|
-
default_provider: z.enum(["manual", "demo"]).optional().default("manual"),
|
|
24
|
-
});
|
|
25
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createServerClient } from "@supabase/ssr";
|
|
2
|
-
import type { cookies } from "next/headers";
|
|
3
|
-
import type { Database } from "../types/database.types";
|
|
4
|
-
|
|
5
|
-
export function useSupabaseServer(
|
|
6
|
-
cookieStore: Awaited<ReturnType<typeof cookies>>,
|
|
7
|
-
) {
|
|
8
|
-
return createServerClient<Database>(
|
|
9
|
-
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
10
|
-
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
11
|
-
{
|
|
12
|
-
cookies: {
|
|
13
|
-
getAll() {
|
|
14
|
-
return cookieStore.getAll();
|
|
15
|
-
},
|
|
16
|
-
setAll(cookiesToSet) {
|
|
17
|
-
try {
|
|
18
|
-
for (const co of cookiesToSet) {
|
|
19
|
-
cookieStore.set(co.name, co.value, co.options);
|
|
20
|
-
}
|
|
21
|
-
} catch (e) {
|
|
22
|
-
//!!! 提示,对于nextjs + honoapi 后端方式使用,可能出现以下错误:
|
|
23
|
-
// Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options
|
|
24
|
-
//可以直接忽略.
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
);
|
|
30
|
-
}
|
package/src/supabase/supabase.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { createServerClient, parseCookieHeader } from "@supabase/ssr";
|
|
2
|
-
import { createClient } from "@supabase/supabase-js";
|
|
3
|
-
import type { Context } from "hono";
|
|
4
|
-
import { setCookie } from "hono/cookie";
|
|
5
|
-
import type { TypedSupabaseClient } from "../types";
|
|
6
|
-
import type { Database } from "../types/database.types";
|
|
7
|
-
|
|
8
|
-
export const getSupabaseUrl = () => {
|
|
9
|
-
if (!process.env.NEXT_PUBLIC_SUPABASE_URL) {
|
|
10
|
-
throw new Error("NEXT_PUBLIC_SUPABASE_URL missing!");
|
|
11
|
-
}
|
|
12
|
-
return process.env.NEXT_PUBLIC_SUPABASE_URL;
|
|
13
|
-
};
|
|
14
|
-
export const getSupabasePublicKey = () => {
|
|
15
|
-
if (!process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) {
|
|
16
|
-
throw new Error("NEXT_PUBLIC_SUPABASE_ANON_KEY missing!");
|
|
17
|
-
}
|
|
18
|
-
return process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const getSupabaseProjectRef = () => {
|
|
22
|
-
const uri = new URL(getSupabaseUrl());
|
|
23
|
-
const supabasePrject = uri.hostname.split(".")[0];
|
|
24
|
-
return supabasePrject;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const getSupabase = (c: Context) => {
|
|
28
|
-
const client: TypedSupabaseClient = createServerClient<Database, "public">(getSupabaseUrl(), getSupabasePublicKey(), {
|
|
29
|
-
cookies: {
|
|
30
|
-
//@ts-expect-error
|
|
31
|
-
getAll() {
|
|
32
|
-
return parseCookieHeader(c.req.header("Cookie") ?? "");
|
|
33
|
-
},
|
|
34
|
-
setAll(cookiesToSet) {
|
|
35
|
-
for (const co of cookiesToSet) {
|
|
36
|
-
//@ts-expect-error
|
|
37
|
-
setCookie(c, co.name, co.value, co.options);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
global: {
|
|
42
|
-
// 由于gomtm supabase 客户端已经登录.所以这里直接传递 Authorization 头,即可.
|
|
43
|
-
headers: {
|
|
44
|
-
...(c.req.header("Authorization") && {
|
|
45
|
-
Authorization: c.req.header("Authorization"),
|
|
46
|
-
}),
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return client;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const getSupabaseAdmin = () => {
|
|
55
|
-
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
|
56
|
-
if (!serviceRoleKey) {
|
|
57
|
-
throw new Error("require SUPABASE_SERVICE_ROLE_KEY");
|
|
58
|
-
}
|
|
59
|
-
const client: TypedSupabaseClient = createClient<Database, "public">(getSupabaseUrl(), serviceRoleKey, {
|
|
60
|
-
auth: {
|
|
61
|
-
autoRefreshToken: false,
|
|
62
|
-
persistSession: false,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
return client;
|
|
67
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AnyPostgrestResponse,
|
|
3
|
-
isPostgrestBuilder,
|
|
4
|
-
isPostgrestTransformBuilder,
|
|
5
|
-
} from "@supabase-cache-helpers/postgrest-core";
|
|
6
|
-
import type { PostgrestError } from "@supabase/postgrest-js";
|
|
7
|
-
import type {
|
|
8
|
-
UseQueryOptions as UseReactQueryOptions,
|
|
9
|
-
UseSuspenseQueryOptions,
|
|
10
|
-
} from "@tanstack/react-query";
|
|
11
|
-
|
|
12
|
-
import { encode } from "./key";
|
|
13
|
-
|
|
14
|
-
export function buildQueryOpts<Result>(
|
|
15
|
-
query: PromiseLike<AnyPostgrestResponse<Result>>,
|
|
16
|
-
config?: Omit<
|
|
17
|
-
UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>,
|
|
18
|
-
"queryKey" | "queryFn"
|
|
19
|
-
>,
|
|
20
|
-
): UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError> {
|
|
21
|
-
return {
|
|
22
|
-
queryKey: encode<Result>(query, false),
|
|
23
|
-
queryFn: async ({ signal }) => {
|
|
24
|
-
if (isPostgrestTransformBuilder(query)) {
|
|
25
|
-
query = query.abortSignal(signal);
|
|
26
|
-
}
|
|
27
|
-
if (isPostgrestBuilder(query)) {
|
|
28
|
-
query = query.throwOnError();
|
|
29
|
-
}
|
|
30
|
-
return await query;
|
|
31
|
-
},
|
|
32
|
-
...config,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function buildSuspenseQueryOpts<Result>(
|
|
37
|
-
query: PromiseLike<AnyPostgrestResponse<Result>>,
|
|
38
|
-
config?: Omit<
|
|
39
|
-
UseSuspenseQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>,
|
|
40
|
-
"queryKey" | "queryFn"
|
|
41
|
-
>,
|
|
42
|
-
): UseSuspenseQueryOptions<AnyPostgrestResponse<Result>, PostgrestError> {
|
|
43
|
-
return {
|
|
44
|
-
queryKey: encode<Result>(query, false),
|
|
45
|
-
queryFn: async ({ signal }) => {
|
|
46
|
-
if (isPostgrestTransformBuilder(query)) {
|
|
47
|
-
query = query.abortSignal(signal);
|
|
48
|
-
}
|
|
49
|
-
if (isPostgrestBuilder(query)) {
|
|
50
|
-
query = query.throwOnError();
|
|
51
|
-
}
|
|
52
|
-
return await query;
|
|
53
|
-
},
|
|
54
|
-
...config,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { type DecodedKey, isPostgrestBuilder, PostgrestParser } from "@supabase-cache-helpers/postgrest-core";
|
|
2
|
-
|
|
3
|
-
export const KEY_PREFIX = "postgrest";
|
|
4
|
-
export const INFINITE_KEY_PREFIX = "page";
|
|
5
|
-
|
|
6
|
-
export type DecodedReactQueryKey = DecodedKey & {
|
|
7
|
-
isInfinite: boolean;
|
|
8
|
-
key: string[];
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const encode = <Result>(key: unknown, isInfinite: boolean): string[] => {
|
|
12
|
-
if (!isPostgrestBuilder<Result>(key)) {
|
|
13
|
-
throw new Error("Key is not a PostgrestBuilder");
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const parser = new PostgrestParser<Result>(key);
|
|
17
|
-
return [
|
|
18
|
-
KEY_PREFIX,
|
|
19
|
-
isInfinite ? INFINITE_KEY_PREFIX : "null",
|
|
20
|
-
parser.schema,
|
|
21
|
-
parser.table,
|
|
22
|
-
parser.queryKey,
|
|
23
|
-
parser.bodyKey ?? "null",
|
|
24
|
-
`count=${parser.count}`,
|
|
25
|
-
`head=${parser.isHead}`,
|
|
26
|
-
parser.orderByKey,
|
|
27
|
-
];
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const decode = (key: unknown): DecodedReactQueryKey | null => {
|
|
31
|
-
if (!Array.isArray(key)) return null;
|
|
32
|
-
|
|
33
|
-
const [prefix, infinitePrefix, schema, table, queryKey, bodyKey, count, head, orderByKey] = key;
|
|
34
|
-
|
|
35
|
-
// Exit early if not a postgrest key
|
|
36
|
-
if (prefix !== KEY_PREFIX) return null;
|
|
37
|
-
|
|
38
|
-
const params = new URLSearchParams(queryKey);
|
|
39
|
-
const limit = params.get("limit");
|
|
40
|
-
const offset = params.get("offset");
|
|
41
|
-
|
|
42
|
-
const countValue = count.replace("count=", "");
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
limit: limit ? Number(limit) : undefined,
|
|
46
|
-
offset: offset ? Number(offset) : undefined,
|
|
47
|
-
bodyKey,
|
|
48
|
-
count: countValue === "null" ? null : countValue,
|
|
49
|
-
isHead: head === "head=true",
|
|
50
|
-
isInfinite: infinitePrefix === INFINITE_KEY_PREFIX,
|
|
51
|
-
key,
|
|
52
|
-
queryKey,
|
|
53
|
-
schema,
|
|
54
|
-
table,
|
|
55
|
-
orderByKey,
|
|
56
|
-
};
|
|
57
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { type AnyPostgrestResponse, isPostgrestBuilder } from "@supabase-cache-helpers/postgrest-core";
|
|
2
|
-
import type {
|
|
3
|
-
PostgrestError,
|
|
4
|
-
PostgrestMaybeSingleResponse,
|
|
5
|
-
PostgrestResponse,
|
|
6
|
-
PostgrestSingleResponse,
|
|
7
|
-
} from "@supabase/postgrest-js";
|
|
8
|
-
import type { FetchQueryOptions, QueryClient } from "@tanstack/react-query";
|
|
9
|
-
import { buildQueryOpts } from "./build-query-opts";
|
|
10
|
-
import { encode } from "./key";
|
|
11
|
-
|
|
12
|
-
function prefetchQuery<Result>(
|
|
13
|
-
queryClient: QueryClient,
|
|
14
|
-
query: PromiseLike<PostgrestSingleResponse<Result>>,
|
|
15
|
-
config?: Omit<FetchQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
16
|
-
): Promise<void>;
|
|
17
|
-
function prefetchQuery<Result>(
|
|
18
|
-
queryClient: QueryClient,
|
|
19
|
-
query: PromiseLike<PostgrestMaybeSingleResponse<Result>>,
|
|
20
|
-
config?: Omit<FetchQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
21
|
-
): Promise<void>;
|
|
22
|
-
function prefetchQuery<Result>(
|
|
23
|
-
queryClient: QueryClient,
|
|
24
|
-
query: PromiseLike<PostgrestResponse<Result>>,
|
|
25
|
-
config?: Omit<FetchQueryOptions<PostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
26
|
-
): Promise<void>;
|
|
27
|
-
|
|
28
|
-
async function prefetchQuery<Result>(
|
|
29
|
-
queryClient: QueryClient,
|
|
30
|
-
query: PromiseLike<AnyPostgrestResponse<Result>>,
|
|
31
|
-
config?: Omit<FetchQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
|
|
32
|
-
) {
|
|
33
|
-
await queryClient.prefetchQuery<AnyPostgrestResponse<Result>, PostgrestError>(buildQueryOpts(query, config));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function fetchQueryInitialData<Result>(
|
|
37
|
-
query: PromiseLike<PostgrestSingleResponse<Result>>,
|
|
38
|
-
): Promise<[string[], PostgrestSingleResponse<Result>]>;
|
|
39
|
-
|
|
40
|
-
function fetchQueryInitialData<Result>(
|
|
41
|
-
query: PromiseLike<PostgrestMaybeSingleResponse<Result>>,
|
|
42
|
-
): Promise<[string[], PostgrestMaybeSingleResponse<Result>]>;
|
|
43
|
-
|
|
44
|
-
function fetchQueryInitialData<Result>(
|
|
45
|
-
query: PromiseLike<PostgrestResponse<Result>>,
|
|
46
|
-
): Promise<[string[], PostgrestResponse<Result>]>;
|
|
47
|
-
|
|
48
|
-
async function fetchQueryInitialData<Result>(
|
|
49
|
-
query: PromiseLike<AnyPostgrestResponse<Result>>,
|
|
50
|
-
): Promise<[string[], AnyPostgrestResponse<Result>]> {
|
|
51
|
-
if (!isPostgrestBuilder<Result>(query)) {
|
|
52
|
-
throw new Error("Query is not a PostgrestBuilder");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return [encode(query, false), await query.throwOnError()];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { fetchQueryInitialData, prefetchQuery };
|
|
59
|
-
|