@rise-x/apps-sdk 0.6.0
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/LICENSE +1 -0
- package/README.md +553 -0
- package/build/_internal.d.ts +2 -0
- package/build/_internal.js +23 -0
- package/build/accessors.d.ts +8 -0
- package/build/accessors.js +40 -0
- package/build/cli/index.d.ts +13 -0
- package/build/cli/index.js +54 -0
- package/build/cli/init.d.ts +6 -0
- package/build/cli/init.js +179 -0
- package/build/cli/templating.d.ts +2 -0
- package/build/cli/templating.js +84 -0
- package/build/connectors/agents.d.ts +85 -0
- package/build/connectors/agents.js +404 -0
- package/build/connectors/assets.d.ts +76 -0
- package/build/connectors/assets.js +204 -0
- package/build/connectors/deps.d.ts +4 -0
- package/build/connectors/deps.js +2 -0
- package/build/connectors/errors.d.ts +11 -0
- package/build/connectors/errors.js +67 -0
- package/build/connectors/flows.d.ts +37 -0
- package/build/connectors/flows.js +191 -0
- package/build/connectors/index.d.ts +8 -0
- package/build/connectors/index.js +50 -0
- package/build/connectors/sse.d.ts +12 -0
- package/build/connectors/sse.js +157 -0
- package/build/connectors/types.d.ts +285 -0
- package/build/connectors/types.js +419 -0
- package/build/connectors/work.d.ts +84 -0
- package/build/connectors/work.js +224 -0
- package/build/hooks.d.ts +4 -0
- package/build/hooks.js +28 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +34 -0
- package/build/lifecycle.d.ts +23 -0
- package/build/lifecycle.js +6 -0
- package/build/mockShell.d.ts +10 -0
- package/build/mockShell.js +55 -0
- package/build/query/agents.d.ts +80 -0
- package/build/query/agents.js +143 -0
- package/build/query/assets.d.ts +73 -0
- package/build/query/assets.js +152 -0
- package/build/query/client.d.ts +5 -0
- package/build/query/client.js +68 -0
- package/build/query/context.d.ts +2 -0
- package/build/query/context.js +34 -0
- package/build/query/flows.d.ts +54 -0
- package/build/query/flows.js +81 -0
- package/build/query/index.d.ts +10 -0
- package/build/query/index.js +85 -0
- package/build/query/keys.d.ts +51 -0
- package/build/query/keys.js +79 -0
- package/build/query/layer.d.ts +175 -0
- package/build/query/layer.js +35 -0
- package/build/query/shared.d.ts +43 -0
- package/build/query/shared.js +116 -0
- package/build/query/work.d.ts +75 -0
- package/build/query/work.js +172 -0
- package/build/shell/index.d.ts +1 -0
- package/build/shell/index.js +6 -0
- package/build/shell/installShellBridge.d.ts +11 -0
- package/build/shell/installShellBridge.js +104 -0
- package/build/shellBridge.d.ts +36 -0
- package/build/shellBridge.js +10 -0
- package/build/topBar.d.ts +25 -0
- package/build/topBar.js +17 -0
- package/build/ui/components/ai.d.ts +49 -0
- package/build/ui/components/alert-dialog.d.ts +27 -0
- package/build/ui/components/alert.d.ts +14 -0
- package/build/ui/components/avatar.d.ts +17 -0
- package/build/ui/components/badge.d.ts +19 -0
- package/build/ui/components/button.d.ts +13 -0
- package/build/ui/components/calendar.d.ts +21 -0
- package/build/ui/components/card.d.ts +16 -0
- package/build/ui/components/chart.d.ts +124 -0
- package/build/ui/components/checkbox.d.ts +4 -0
- package/build/ui/components/data-table.d.ts +70 -0
- package/build/ui/components/dialog.d.ts +17 -0
- package/build/ui/components/dropdown-menu.d.ts +29 -0
- package/build/ui/components/empty-state.d.ts +7 -0
- package/build/ui/components/file-upload.d.ts +17 -0
- package/build/ui/components/input.d.ts +8 -0
- package/build/ui/components/label.d.ts +4 -0
- package/build/ui/components/list.d.ts +24 -0
- package/build/ui/components/map.d.ts +26 -0
- package/build/ui/components/message.d.ts +24 -0
- package/build/ui/components/nav.d.ts +12 -0
- package/build/ui/components/page-header.d.ts +27 -0
- package/build/ui/components/popover.d.ts +10 -0
- package/build/ui/components/progress.d.ts +4 -0
- package/build/ui/components/radio.d.ts +6 -0
- package/build/ui/components/resizable.d.ts +7 -0
- package/build/ui/components/scroll-area.d.ts +5 -0
- package/build/ui/components/segmented.d.ts +6 -0
- package/build/ui/components/select.d.ts +15 -0
- package/build/ui/components/separator.d.ts +4 -0
- package/build/ui/components/sheet.d.ts +14 -0
- package/build/ui/components/skeleton.d.ts +3 -0
- package/build/ui/components/slider.d.ts +15 -0
- package/build/ui/components/snackbar.d.ts +3 -0
- package/build/ui/components/sonner.d.ts +4 -0
- package/build/ui/components/spinner.d.ts +5 -0
- package/build/ui/components/statistic.d.ts +19 -0
- package/build/ui/components/stepper.d.ts +12 -0
- package/build/ui/components/switch.d.ts +6 -0
- package/build/ui/components/table.d.ts +24 -0
- package/build/ui/components/textarea.d.ts +3 -0
- package/build/ui/components/timeline.d.ts +15 -0
- package/build/ui/components/toggle-group.d.ts +10 -0
- package/build/ui/components/toggle.d.ts +9 -0
- package/build/ui/components/tooltip.d.ts +7 -0
- package/build/ui/index.d.ts +46 -0
- package/build/ui/index.js +8 -0
- package/build/ui/lib/utils.d.ts +2 -0
- package/build/ui/reference/README.md +11 -0
- package/build/ui/reference/components/ai.tsx +291 -0
- package/build/ui/reference/components/alert-dialog.tsx +208 -0
- package/build/ui/reference/components/alert.tsx +112 -0
- package/build/ui/reference/components/avatar.tsx +158 -0
- package/build/ui/reference/components/badge.tsx +160 -0
- package/build/ui/reference/components/button.tsx +100 -0
- package/build/ui/reference/components/calendar.tsx +119 -0
- package/build/ui/reference/components/card.tsx +144 -0
- package/build/ui/reference/components/chart.tsx +1394 -0
- package/build/ui/reference/components/checkbox.tsx +44 -0
- package/build/ui/reference/components/data-table.tsx +480 -0
- package/build/ui/reference/components/dialog.tsx +172 -0
- package/build/ui/reference/components/dropdown-menu.tsx +245 -0
- package/build/ui/reference/components/empty-state.tsx +63 -0
- package/build/ui/reference/components/file-upload.tsx +116 -0
- package/build/ui/reference/components/input.tsx +114 -0
- package/build/ui/reference/components/label.tsx +19 -0
- package/build/ui/reference/components/list.tsx +191 -0
- package/build/ui/reference/components/map.css +251 -0
- package/build/ui/reference/components/map.tsx +294 -0
- package/build/ui/reference/components/message.tsx +171 -0
- package/build/ui/reference/components/nav.tsx +113 -0
- package/build/ui/reference/components/page-header.tsx +213 -0
- package/build/ui/reference/components/popover.tsx +76 -0
- package/build/ui/reference/components/progress.tsx +31 -0
- package/build/ui/reference/components/radio.tsx +65 -0
- package/build/ui/reference/components/resizable.tsx +40 -0
- package/build/ui/reference/components/scroll-area.tsx +55 -0
- package/build/ui/reference/components/segmented.tsx +45 -0
- package/build/ui/reference/components/select.tsx +185 -0
- package/build/ui/reference/components/separator.tsx +26 -0
- package/build/ui/reference/components/sheet.tsx +173 -0
- package/build/ui/reference/components/skeleton.tsx +15 -0
- package/build/ui/reference/components/slider.tsx +161 -0
- package/build/ui/reference/components/snackbar.tsx +27 -0
- package/build/ui/reference/components/sonner.tsx +43 -0
- package/build/ui/reference/components/spinner.tsx +27 -0
- package/build/ui/reference/components/statistic.tsx +122 -0
- package/build/ui/reference/components/stepper.tsx +138 -0
- package/build/ui/reference/components/switch.tsx +47 -0
- package/build/ui/reference/components/table.tsx +233 -0
- package/build/ui/reference/components/textarea.tsx +28 -0
- package/build/ui/reference/components/timeline.tsx +94 -0
- package/build/ui/reference/components/toggle-group.tsx +86 -0
- package/build/ui/reference/components/toggle.tsx +46 -0
- package/build/ui/reference/components/tooltip.tsx +53 -0
- package/build/ui/reference/index.ts +49 -0
- package/build/ui/reference/lib/utils.ts +34 -0
- package/build/ui/standalone-stub.js +5 -0
- package/build/ui/standalone.js +135 -0
- package/build/ui/styles.css +3 -0
- package/connectors/package.json +8 -0
- package/package.json +114 -0
- package/query/package.json +8 -0
- package/shell/package.json +8 -0
- package/template/AGENTS.md +70 -0
- package/template/CLAUDE.md +4 -0
- package/template/README.md +102 -0
- package/template/_gitignore +6 -0
- package/template/commitlint.config.js +12 -0
- package/template/package.json +31 -0
- package/template/public/index.html +13 -0
- package/template/src/App.tsx +171 -0
- package/template/src/bootstrap.tsx +13 -0
- package/template/src/index.tsx +1 -0
- package/template/src/lifecycle.ts +20 -0
- package/template/tsconfig.json +31 -0
- package/template/webpack.config.js +112 -0
- package/template/webpack.local.config.js +68 -0
- package/ui/package.json +8 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @rise-x/apps-sdk/query — a @tanstack/react-query v5 layer over the
|
|
3
|
+
// connectors: request dedupe, caching, background refetch, and cancellation
|
|
4
|
+
// for free.
|
|
5
|
+
//
|
|
6
|
+
// Zero config: the hooks resolve their QueryClient from React context (the
|
|
7
|
+
// Rise-X shell mounts a per-app client around every federated app) and fall
|
|
8
|
+
// back to a per-bundle client otherwise — no provider required in app code.
|
|
9
|
+
// Requires the app to share '@tanstack/react-query' (singleton) in its
|
|
10
|
+
// webpack ModuleFederation config for the shell-managed client to reach it.
|
|
11
|
+
//
|
|
12
|
+
// Layout: one file per domain (flows/work/assets/agents), each holding its
|
|
13
|
+
// queryOptions factory, live singleton, read hooks, and mutations — including
|
|
14
|
+
// the invalidation those mutations perform. Cross-domain invalidations are
|
|
15
|
+
// marked CROSS-DOMAIN at the trigger site (work.submit ↔ assets drafts).
|
|
16
|
+
//
|
|
17
|
+
// Deliberately NOT re-exported from the package root: apps that don't import
|
|
18
|
+
// this subpath never load react-query.
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.useDeleteAgentChat = exports.useDeleteAgent = exports.useCreateAgent = exports.useAgents = exports.useAgentChats = exports.useAgentChatMessages = exports.useAgentChat = exports.useAgent = exports.createAgentQueries = exports.agentQueries = exports.useStartEditAsset = exports.useRelatedAssets = exports.useDeleteAsset = exports.useCreateAsset = exports.useCloneAsset = exports.useAssetTypes = exports.useAssetSearch = exports.useAssetRows = exports.useAsset = exports.createAssetQueries = exports.assetQueries = exports.workQueries = exports.useWorkRows = exports.useWorkData = exports.useWorkAudit = exports.useWork = exports.useSubmitWork = exports.useStartWork = exports.useRelatedWork = exports.usePatchWorkData = exports.useDeleteWork = exports.dedupeRows = exports.createWorkQueries = exports.useFlowTask = exports.useFlows = exports.useFlowLayout = exports.useFlowConfig = exports.useFlow = exports.flowQueries = exports.createFlowQueries = exports.createQueryLayer = exports.invalidateAppSdkQueries = exports.getLiveEnvId = exports.useAppQueryClient = exports.shouldRetryConnectorError = exports.getFallbackAppClient = exports.createAppQueryClient = exports.QUERY_KEY_ROOT = exports.queryKeys = exports.normalizeArgs = void 0;
|
|
21
|
+
exports.ConnectorError = exports.useUpdateAgent = exports.useRenameAgentChat = void 0;
|
|
22
|
+
var keys_1 = require("./keys");
|
|
23
|
+
Object.defineProperty(exports, "normalizeArgs", { enumerable: true, get: function () { return keys_1.normalizeArgs; } });
|
|
24
|
+
Object.defineProperty(exports, "queryKeys", { enumerable: true, get: function () { return keys_1.queryKeys; } });
|
|
25
|
+
Object.defineProperty(exports, "QUERY_KEY_ROOT", { enumerable: true, get: function () { return keys_1.QUERY_KEY_ROOT; } });
|
|
26
|
+
var client_1 = require("./client");
|
|
27
|
+
Object.defineProperty(exports, "createAppQueryClient", { enumerable: true, get: function () { return client_1.createAppQueryClient; } });
|
|
28
|
+
Object.defineProperty(exports, "getFallbackAppClient", { enumerable: true, get: function () { return client_1.getFallbackAppClient; } });
|
|
29
|
+
Object.defineProperty(exports, "shouldRetryConnectorError", { enumerable: true, get: function () { return client_1.shouldRetryConnectorError; } });
|
|
30
|
+
var context_1 = require("./context");
|
|
31
|
+
Object.defineProperty(exports, "useAppQueryClient", { enumerable: true, get: function () { return context_1.useAppQueryClient; } });
|
|
32
|
+
var shared_1 = require("./shared");
|
|
33
|
+
Object.defineProperty(exports, "getLiveEnvId", { enumerable: true, get: function () { return shared_1.getLiveEnvId; } });
|
|
34
|
+
Object.defineProperty(exports, "invalidateAppSdkQueries", { enumerable: true, get: function () { return shared_1.invalidateAppSdkQueries; } });
|
|
35
|
+
var layer_1 = require("./layer");
|
|
36
|
+
Object.defineProperty(exports, "createQueryLayer", { enumerable: true, get: function () { return layer_1.createQueryLayer; } });
|
|
37
|
+
var flows_1 = require("./flows");
|
|
38
|
+
Object.defineProperty(exports, "createFlowQueries", { enumerable: true, get: function () { return flows_1.createFlowQueries; } });
|
|
39
|
+
Object.defineProperty(exports, "flowQueries", { enumerable: true, get: function () { return flows_1.flowQueries; } });
|
|
40
|
+
Object.defineProperty(exports, "useFlow", { enumerable: true, get: function () { return flows_1.useFlow; } });
|
|
41
|
+
Object.defineProperty(exports, "useFlowConfig", { enumerable: true, get: function () { return flows_1.useFlowConfig; } });
|
|
42
|
+
Object.defineProperty(exports, "useFlowLayout", { enumerable: true, get: function () { return flows_1.useFlowLayout; } });
|
|
43
|
+
Object.defineProperty(exports, "useFlows", { enumerable: true, get: function () { return flows_1.useFlows; } });
|
|
44
|
+
Object.defineProperty(exports, "useFlowTask", { enumerable: true, get: function () { return flows_1.useFlowTask; } });
|
|
45
|
+
var work_1 = require("./work");
|
|
46
|
+
Object.defineProperty(exports, "createWorkQueries", { enumerable: true, get: function () { return work_1.createWorkQueries; } });
|
|
47
|
+
Object.defineProperty(exports, "dedupeRows", { enumerable: true, get: function () { return work_1.dedupeRows; } });
|
|
48
|
+
Object.defineProperty(exports, "useDeleteWork", { enumerable: true, get: function () { return work_1.useDeleteWork; } });
|
|
49
|
+
Object.defineProperty(exports, "usePatchWorkData", { enumerable: true, get: function () { return work_1.usePatchWorkData; } });
|
|
50
|
+
Object.defineProperty(exports, "useRelatedWork", { enumerable: true, get: function () { return work_1.useRelatedWork; } });
|
|
51
|
+
Object.defineProperty(exports, "useStartWork", { enumerable: true, get: function () { return work_1.useStartWork; } });
|
|
52
|
+
Object.defineProperty(exports, "useSubmitWork", { enumerable: true, get: function () { return work_1.useSubmitWork; } });
|
|
53
|
+
Object.defineProperty(exports, "useWork", { enumerable: true, get: function () { return work_1.useWork; } });
|
|
54
|
+
Object.defineProperty(exports, "useWorkAudit", { enumerable: true, get: function () { return work_1.useWorkAudit; } });
|
|
55
|
+
Object.defineProperty(exports, "useWorkData", { enumerable: true, get: function () { return work_1.useWorkData; } });
|
|
56
|
+
Object.defineProperty(exports, "useWorkRows", { enumerable: true, get: function () { return work_1.useWorkRows; } });
|
|
57
|
+
Object.defineProperty(exports, "workQueries", { enumerable: true, get: function () { return work_1.workQueries; } });
|
|
58
|
+
var assets_1 = require("./assets");
|
|
59
|
+
Object.defineProperty(exports, "assetQueries", { enumerable: true, get: function () { return assets_1.assetQueries; } });
|
|
60
|
+
Object.defineProperty(exports, "createAssetQueries", { enumerable: true, get: function () { return assets_1.createAssetQueries; } });
|
|
61
|
+
Object.defineProperty(exports, "useAsset", { enumerable: true, get: function () { return assets_1.useAsset; } });
|
|
62
|
+
Object.defineProperty(exports, "useAssetRows", { enumerable: true, get: function () { return assets_1.useAssetRows; } });
|
|
63
|
+
Object.defineProperty(exports, "useAssetSearch", { enumerable: true, get: function () { return assets_1.useAssetSearch; } });
|
|
64
|
+
Object.defineProperty(exports, "useAssetTypes", { enumerable: true, get: function () { return assets_1.useAssetTypes; } });
|
|
65
|
+
Object.defineProperty(exports, "useCloneAsset", { enumerable: true, get: function () { return assets_1.useCloneAsset; } });
|
|
66
|
+
Object.defineProperty(exports, "useCreateAsset", { enumerable: true, get: function () { return assets_1.useCreateAsset; } });
|
|
67
|
+
Object.defineProperty(exports, "useDeleteAsset", { enumerable: true, get: function () { return assets_1.useDeleteAsset; } });
|
|
68
|
+
Object.defineProperty(exports, "useRelatedAssets", { enumerable: true, get: function () { return assets_1.useRelatedAssets; } });
|
|
69
|
+
Object.defineProperty(exports, "useStartEditAsset", { enumerable: true, get: function () { return assets_1.useStartEditAsset; } });
|
|
70
|
+
var agents_1 = require("./agents");
|
|
71
|
+
Object.defineProperty(exports, "agentQueries", { enumerable: true, get: function () { return agents_1.agentQueries; } });
|
|
72
|
+
Object.defineProperty(exports, "createAgentQueries", { enumerable: true, get: function () { return agents_1.createAgentQueries; } });
|
|
73
|
+
Object.defineProperty(exports, "useAgent", { enumerable: true, get: function () { return agents_1.useAgent; } });
|
|
74
|
+
Object.defineProperty(exports, "useAgentChat", { enumerable: true, get: function () { return agents_1.useAgentChat; } });
|
|
75
|
+
Object.defineProperty(exports, "useAgentChatMessages", { enumerable: true, get: function () { return agents_1.useAgentChatMessages; } });
|
|
76
|
+
Object.defineProperty(exports, "useAgentChats", { enumerable: true, get: function () { return agents_1.useAgentChats; } });
|
|
77
|
+
Object.defineProperty(exports, "useAgents", { enumerable: true, get: function () { return agents_1.useAgents; } });
|
|
78
|
+
Object.defineProperty(exports, "useCreateAgent", { enumerable: true, get: function () { return agents_1.useCreateAgent; } });
|
|
79
|
+
Object.defineProperty(exports, "useDeleteAgent", { enumerable: true, get: function () { return agents_1.useDeleteAgent; } });
|
|
80
|
+
Object.defineProperty(exports, "useDeleteAgentChat", { enumerable: true, get: function () { return agents_1.useDeleteAgentChat; } });
|
|
81
|
+
Object.defineProperty(exports, "useRenameAgentChat", { enumerable: true, get: function () { return agents_1.useRenameAgentChat; } });
|
|
82
|
+
Object.defineProperty(exports, "useUpdateAgent", { enumerable: true, get: function () { return agents_1.useUpdateAgent; } });
|
|
83
|
+
// Error narrowing convenience — every hook error is a ConnectorError.
|
|
84
|
+
var errors_1 = require("../connectors/errors");
|
|
85
|
+
Object.defineProperty(exports, "ConnectorError", { enumerable: true, get: function () { return errors_1.ConnectorError; } });
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type QueryEnvId = string | null;
|
|
2
|
+
declare const ROOT: "rise-apps-sdk";
|
|
3
|
+
export declare const QUERY_KEY_ROOT: typeof ROOT;
|
|
4
|
+
export declare function normalizeArgs(args?: object): Record<string, unknown>;
|
|
5
|
+
type Args = Record<string, unknown>;
|
|
6
|
+
export declare const queryKeys: {
|
|
7
|
+
readonly all: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId];
|
|
8
|
+
readonly flows: {
|
|
9
|
+
readonly all: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "flows"];
|
|
10
|
+
readonly lists: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "flows", "list"];
|
|
11
|
+
readonly list: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "flows", "list", Args];
|
|
12
|
+
readonly detail: (envId: QueryEnvId, flowId: string) => readonly ["rise-apps-sdk", QueryEnvId, "flows", "detail", string];
|
|
13
|
+
readonly config: (envId: QueryEnvId, flowId: string) => readonly ["rise-apps-sdk", QueryEnvId, "flows", "config", string];
|
|
14
|
+
readonly layout: (envId: QueryEnvId, layoutId: string) => readonly ["rise-apps-sdk", QueryEnvId, "flows", "layout", string];
|
|
15
|
+
readonly task: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "flows", "task", Args];
|
|
16
|
+
};
|
|
17
|
+
readonly work: {
|
|
18
|
+
readonly all: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "work"];
|
|
19
|
+
readonly detail: (envId: QueryEnvId, workId: string) => readonly ["rise-apps-sdk", QueryEnvId, "work", "detail", string];
|
|
20
|
+
readonly dataAll: (envId: QueryEnvId, workId: string) => readonly ["rise-apps-sdk", QueryEnvId, "work", "data", string];
|
|
21
|
+
readonly data: (envId: QueryEnvId, workId: string, path?: string) => readonly ["rise-apps-sdk", QueryEnvId, "work", "data", string, string | null];
|
|
22
|
+
readonly allRows: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "work", "rows"];
|
|
23
|
+
readonly rows: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "work", "rows", Args];
|
|
24
|
+
readonly relatedAll: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "work", "related"];
|
|
25
|
+
readonly related: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "work", "related", Args];
|
|
26
|
+
readonly audit: (envId: QueryEnvId, workId: string) => readonly ["rise-apps-sdk", QueryEnvId, "work", "audit", string];
|
|
27
|
+
};
|
|
28
|
+
readonly assets: {
|
|
29
|
+
readonly all: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "assets"];
|
|
30
|
+
readonly types: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "types"];
|
|
31
|
+
readonly detail: (envId: QueryEnvId, assetId: string) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "detail", string];
|
|
32
|
+
readonly searchAll: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "search"];
|
|
33
|
+
readonly search: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "search", Args];
|
|
34
|
+
readonly allRows: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "rows"];
|
|
35
|
+
readonly rows: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "rows", Args];
|
|
36
|
+
readonly relatedAll: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "related"];
|
|
37
|
+
readonly related: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "assets", "related", Args];
|
|
38
|
+
};
|
|
39
|
+
readonly agents: {
|
|
40
|
+
readonly all: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "agents"];
|
|
41
|
+
readonly lists: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "list"];
|
|
42
|
+
readonly list: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "list", Args];
|
|
43
|
+
readonly detail: (envId: QueryEnvId, id: string) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "detail", string];
|
|
44
|
+
readonly chatsAll: (envId: QueryEnvId) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "chats"];
|
|
45
|
+
readonly chats: (envId: QueryEnvId, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "chats", Args];
|
|
46
|
+
readonly chat: (envId: QueryEnvId, id: string) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "chat", string];
|
|
47
|
+
readonly chatMessagesAll: (envId: QueryEnvId, id: string) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "chatMessages", string];
|
|
48
|
+
readonly chatMessages: (envId: QueryEnvId, id: string, args: Args) => readonly ["rise-apps-sdk", QueryEnvId, "agents", "chatMessages", string, Args];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Query-key factory for the @rise-x/apps-sdk/query layer.
|
|
3
|
+
//
|
|
4
|
+
// Every key is rooted at ['rise-apps-sdk', envId, ...] — the environment
|
|
5
|
+
// (ecosystem) id scopes all server data, so an environment switch recomputes
|
|
6
|
+
// every key and react-query refetches under the new scope while the old
|
|
7
|
+
// entries age out via gcTime. Keys are exported publicly so apps can do their
|
|
8
|
+
// own targeted invalidation with the exact same shapes the hooks use.
|
|
9
|
+
//
|
|
10
|
+
// `envId` is null while the shell hasn't reported an environment yet; the
|
|
11
|
+
// queryOptions factories disable the query in that state, so null-keyed
|
|
12
|
+
// entries never hold real data.
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.queryKeys = exports.QUERY_KEY_ROOT = void 0;
|
|
15
|
+
exports.normalizeArgs = normalizeArgs;
|
|
16
|
+
const ROOT = "rise-apps-sdk";
|
|
17
|
+
// The first element of every key this SDK creates — prefix for cross-env
|
|
18
|
+
// invalidation (see invalidateAppSdkQueries).
|
|
19
|
+
exports.QUERY_KEY_ROOT = ROOT;
|
|
20
|
+
// Strip request-only fields from an args object so it can serve as a stable
|
|
21
|
+
// key part: `signal` never belongs in a key, and dropping `undefined` values
|
|
22
|
+
// makes `{search: undefined}` and `{}` hash identically (v5's default hashKey
|
|
23
|
+
// already sorts object keys, so property order doesn't matter).
|
|
24
|
+
function normalizeArgs(args) {
|
|
25
|
+
const out = {};
|
|
26
|
+
for (const [key, value] of Object.entries(args ?? {})) {
|
|
27
|
+
if (key === "signal" || value === undefined)
|
|
28
|
+
continue;
|
|
29
|
+
out[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
exports.queryKeys = {
|
|
34
|
+
all: (envId) => [ROOT, envId],
|
|
35
|
+
flows: {
|
|
36
|
+
all: (envId) => [ROOT, envId, "flows"],
|
|
37
|
+
lists: (envId) => [ROOT, envId, "flows", "list"],
|
|
38
|
+
list: (envId, args) => [ROOT, envId, "flows", "list", args],
|
|
39
|
+
detail: (envId, flowId) => [ROOT, envId, "flows", "detail", flowId],
|
|
40
|
+
config: (envId, flowId) => [ROOT, envId, "flows", "config", flowId],
|
|
41
|
+
layout: (envId, layoutId) => [ROOT, envId, "flows", "layout", layoutId],
|
|
42
|
+
task: (envId, args) => [ROOT, envId, "flows", "task", args],
|
|
43
|
+
},
|
|
44
|
+
work: {
|
|
45
|
+
all: (envId) => [ROOT, envId, "work"],
|
|
46
|
+
detail: (envId, workId) => [ROOT, envId, "work", "detail", workId],
|
|
47
|
+
// Prefix over every data() path of one work item — invalidation target.
|
|
48
|
+
dataAll: (envId, workId) => [ROOT, envId, "work", "data", workId],
|
|
49
|
+
data: (envId, workId, path) => [ROOT, envId, "work", "data", workId, path ?? null],
|
|
50
|
+
// Prefix over every rows() listing — invalidation target.
|
|
51
|
+
allRows: (envId) => [ROOT, envId, "work", "rows"],
|
|
52
|
+
rows: (envId, args) => [ROOT, envId, "work", "rows", args],
|
|
53
|
+
relatedAll: (envId) => [ROOT, envId, "work", "related"],
|
|
54
|
+
related: (envId, args) => [ROOT, envId, "work", "related", args],
|
|
55
|
+
audit: (envId, workId) => [ROOT, envId, "work", "audit", workId],
|
|
56
|
+
},
|
|
57
|
+
assets: {
|
|
58
|
+
all: (envId) => [ROOT, envId, "assets"],
|
|
59
|
+
types: (envId) => [ROOT, envId, "assets", "types"],
|
|
60
|
+
detail: (envId, assetId) => [ROOT, envId, "assets", "detail", assetId],
|
|
61
|
+
searchAll: (envId) => [ROOT, envId, "assets", "search"],
|
|
62
|
+
search: (envId, args) => [ROOT, envId, "assets", "search", args],
|
|
63
|
+
allRows: (envId) => [ROOT, envId, "assets", "rows"],
|
|
64
|
+
rows: (envId, args) => [ROOT, envId, "assets", "rows", args],
|
|
65
|
+
relatedAll: (envId) => [ROOT, envId, "assets", "related"],
|
|
66
|
+
related: (envId, args) => [ROOT, envId, "assets", "related", args],
|
|
67
|
+
},
|
|
68
|
+
agents: {
|
|
69
|
+
all: (envId) => [ROOT, envId, "agents"],
|
|
70
|
+
lists: (envId) => [ROOT, envId, "agents", "list"],
|
|
71
|
+
list: (envId, args) => [ROOT, envId, "agents", "list", args],
|
|
72
|
+
detail: (envId, id) => [ROOT, envId, "agents", "detail", id],
|
|
73
|
+
chatsAll: (envId) => [ROOT, envId, "agents", "chats"],
|
|
74
|
+
chats: (envId, args) => [ROOT, envId, "agents", "chats", args],
|
|
75
|
+
chat: (envId, id) => [ROOT, envId, "agents", "chat", id],
|
|
76
|
+
chatMessagesAll: (envId, id) => [ROOT, envId, "agents", "chatMessages", id],
|
|
77
|
+
chatMessages: (envId, id, args) => [ROOT, envId, "agents", "chatMessages", id, args],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { ConnectorDeps } from "../connectors/deps";
|
|
2
|
+
import type { QueryEnvId } from "./keys";
|
|
3
|
+
export declare function createQueryLayer(deps?: ConnectorDeps): {
|
|
4
|
+
flowQueries: {
|
|
5
|
+
list: (args?: import("./flows").ListFlowsQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").FlowSummary[], Error, import("../connectors").FlowSummary[], readonly ["rise-apps-sdk", QueryEnvId, "flows", "list", {
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
}]>, "queryFn"> & {
|
|
8
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").FlowSummary[], readonly ["rise-apps-sdk", QueryEnvId, "flows", "list", {
|
|
9
|
+
[x: string]: unknown;
|
|
10
|
+
}], never> | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "flows", "list", {
|
|
13
|
+
[x: string]: unknown;
|
|
14
|
+
}], import("../connectors").FlowSummary[]>;
|
|
15
|
+
};
|
|
16
|
+
detail: (flowId: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").Flow, Error, import("../connectors").Flow, readonly ["rise-apps-sdk", QueryEnvId, "flows", "detail", string]>, "queryFn"> & {
|
|
17
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").Flow, readonly ["rise-apps-sdk", QueryEnvId, "flows", "detail", string], never> | undefined;
|
|
18
|
+
} & {
|
|
19
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "flows", "detail", string], import("../connectors").Flow>;
|
|
20
|
+
};
|
|
21
|
+
config: (flowId: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").FlowConfig, Error, import("../connectors").FlowConfig, readonly ["rise-apps-sdk", QueryEnvId, "flows", "config", string]>, "queryFn"> & {
|
|
22
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").FlowConfig, readonly ["rise-apps-sdk", QueryEnvId, "flows", "config", string], never> | undefined;
|
|
23
|
+
} & {
|
|
24
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "flows", "config", string], import("../connectors").FlowConfig>;
|
|
25
|
+
};
|
|
26
|
+
layout: (layoutId: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").Layout, Error, import("../connectors").Layout, readonly ["rise-apps-sdk", QueryEnvId, "flows", "layout", string]>, "queryFn"> & {
|
|
27
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").Layout, readonly ["rise-apps-sdk", QueryEnvId, "flows", "layout", string], never> | undefined;
|
|
28
|
+
} & {
|
|
29
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "flows", "layout", string], import("../connectors").Layout>;
|
|
30
|
+
};
|
|
31
|
+
task: (args: import("./flows").FindTaskQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors/flows").FindTaskResult | null, Error, import("../connectors/flows").FindTaskResult | null, readonly ["rise-apps-sdk", QueryEnvId, "flows", "task", {
|
|
32
|
+
[x: string]: unknown;
|
|
33
|
+
}]>, "queryFn"> & {
|
|
34
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors/flows").FindTaskResult | null, readonly ["rise-apps-sdk", QueryEnvId, "flows", "task", {
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
}], never> | undefined;
|
|
37
|
+
} & {
|
|
38
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "flows", "task", {
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
}], import("../connectors/flows").FindTaskResult | null>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
workQueries: {
|
|
44
|
+
detail: (workId: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").WorkDetail, Error, import("../connectors").WorkDetail, readonly ["rise-apps-sdk", QueryEnvId, "work", "detail", string]>, "queryFn"> & {
|
|
45
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").WorkDetail, readonly ["rise-apps-sdk", QueryEnvId, "work", "detail", string], never> | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "work", "detail", string], import("../connectors").WorkDetail>;
|
|
48
|
+
};
|
|
49
|
+
data: (workId: string, opts?: {
|
|
50
|
+
path?: string;
|
|
51
|
+
}) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<unknown, Error, unknown, readonly ["rise-apps-sdk", QueryEnvId, "work", "data", string, string | null]>, "queryFn"> & {
|
|
52
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<unknown, readonly ["rise-apps-sdk", QueryEnvId, "work", "data", string, string | null], never> | undefined;
|
|
53
|
+
} & {
|
|
54
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "work", "data", string, string | null], unknown>;
|
|
55
|
+
};
|
|
56
|
+
rows: (args: import("./work").ListWorkRowsQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseInfiniteQueryOptions<import("../connectors/work").WorkRowPage, Error, import("@tanstack/query-core").InfiniteData<import("../connectors/work").WorkRowPage, unknown>, import("../connectors/work").WorkRowPage, readonly ["rise-apps-sdk", QueryEnvId, "work", "rows", {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
}], number>, "queryFn"> & {
|
|
59
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors/work").WorkRowPage, readonly ["rise-apps-sdk", QueryEnvId, "work", "rows", {
|
|
60
|
+
[x: string]: unknown;
|
|
61
|
+
}], number> | undefined;
|
|
62
|
+
} & {
|
|
63
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "work", "rows", {
|
|
64
|
+
[x: string]: unknown;
|
|
65
|
+
}], import("@tanstack/query-core").InfiniteData<import("../connectors/work").WorkRowPage, unknown>>;
|
|
66
|
+
};
|
|
67
|
+
related: (args: import("./work").ListRelatedWorkQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").WorkRow[], Error, import("../connectors").WorkRow[], readonly ["rise-apps-sdk", QueryEnvId, "work", "related", {
|
|
68
|
+
[x: string]: unknown;
|
|
69
|
+
}]>, "queryFn"> & {
|
|
70
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").WorkRow[], readonly ["rise-apps-sdk", QueryEnvId, "work", "related", {
|
|
71
|
+
[x: string]: unknown;
|
|
72
|
+
}], never> | undefined;
|
|
73
|
+
} & {
|
|
74
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "work", "related", {
|
|
75
|
+
[x: string]: unknown;
|
|
76
|
+
}], import("../connectors").WorkRow[]>;
|
|
77
|
+
};
|
|
78
|
+
audit: (workId: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").WorkAuditEvent[], Error, import("../connectors").WorkAuditEvent[], readonly ["rise-apps-sdk", QueryEnvId, "work", "audit", string]>, "queryFn"> & {
|
|
79
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").WorkAuditEvent[], readonly ["rise-apps-sdk", QueryEnvId, "work", "audit", string], never> | undefined;
|
|
80
|
+
} & {
|
|
81
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "work", "audit", string], import("../connectors").WorkAuditEvent[]>;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
assetQueries: {
|
|
85
|
+
types: () => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AssetType[], Error, import("../connectors").AssetType[], readonly ["rise-apps-sdk", QueryEnvId, "assets", "types"]>, "queryFn"> & {
|
|
86
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AssetType[], readonly ["rise-apps-sdk", QueryEnvId, "assets", "types"], never> | undefined;
|
|
87
|
+
} & {
|
|
88
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "assets", "types"], import("../connectors").AssetType[]>;
|
|
89
|
+
};
|
|
90
|
+
detail: (assetId: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AssetDetail, Error, import("../connectors").AssetDetail, readonly ["rise-apps-sdk", QueryEnvId, "assets", "detail", string]>, "queryFn"> & {
|
|
91
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AssetDetail, readonly ["rise-apps-sdk", QueryEnvId, "assets", "detail", string], never> | undefined;
|
|
92
|
+
} & {
|
|
93
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "assets", "detail", string], import("../connectors").AssetDetail>;
|
|
94
|
+
};
|
|
95
|
+
search: (args: import("./assets").SearchAssetsQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AssetSummary[], Error, import("../connectors").AssetSummary[], readonly ["rise-apps-sdk", QueryEnvId, "assets", "search", {
|
|
96
|
+
[x: string]: unknown;
|
|
97
|
+
}]>, "queryFn"> & {
|
|
98
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AssetSummary[], readonly ["rise-apps-sdk", QueryEnvId, "assets", "search", {
|
|
99
|
+
[x: string]: unknown;
|
|
100
|
+
}], never> | undefined;
|
|
101
|
+
} & {
|
|
102
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "assets", "search", {
|
|
103
|
+
[x: string]: unknown;
|
|
104
|
+
}], import("../connectors").AssetSummary[]>;
|
|
105
|
+
};
|
|
106
|
+
rows: (args: import("./assets").ListAssetRowsQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseInfiniteQueryOptions<import("../connectors/assets").AssetRowPage, Error, import("@tanstack/query-core").InfiniteData<import("../connectors/assets").AssetRowPage, unknown>, import("../connectors/assets").AssetRowPage, readonly ["rise-apps-sdk", QueryEnvId, "assets", "rows", {
|
|
107
|
+
[x: string]: unknown;
|
|
108
|
+
}], number>, "queryFn"> & {
|
|
109
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors/assets").AssetRowPage, readonly ["rise-apps-sdk", QueryEnvId, "assets", "rows", {
|
|
110
|
+
[x: string]: unknown;
|
|
111
|
+
}], number> | undefined;
|
|
112
|
+
} & {
|
|
113
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "assets", "rows", {
|
|
114
|
+
[x: string]: unknown;
|
|
115
|
+
}], import("@tanstack/query-core").InfiniteData<import("../connectors/assets").AssetRowPage, unknown>>;
|
|
116
|
+
};
|
|
117
|
+
related: (args: import("./assets").ListRelatedAssetsQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AssetSummary[], Error, import("../connectors").AssetSummary[], readonly ["rise-apps-sdk", QueryEnvId, "assets", "related", {
|
|
118
|
+
[x: string]: unknown;
|
|
119
|
+
}]>, "queryFn"> & {
|
|
120
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AssetSummary[], readonly ["rise-apps-sdk", QueryEnvId, "assets", "related", {
|
|
121
|
+
[x: string]: unknown;
|
|
122
|
+
}], never> | undefined;
|
|
123
|
+
} & {
|
|
124
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "assets", "related", {
|
|
125
|
+
[x: string]: unknown;
|
|
126
|
+
}], import("../connectors").AssetSummary[]>;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
agentQueries: {
|
|
130
|
+
list: (args?: import("./agents").ListAgentsQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AgentPage, Error, import("../connectors").AgentPage, readonly ["rise-apps-sdk", QueryEnvId, "agents", "list", {
|
|
131
|
+
[x: string]: unknown;
|
|
132
|
+
}]>, "queryFn"> & {
|
|
133
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AgentPage, readonly ["rise-apps-sdk", QueryEnvId, "agents", "list", {
|
|
134
|
+
[x: string]: unknown;
|
|
135
|
+
}], never> | undefined;
|
|
136
|
+
} & {
|
|
137
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "agents", "list", {
|
|
138
|
+
[x: string]: unknown;
|
|
139
|
+
}], import("../connectors").AgentPage>;
|
|
140
|
+
};
|
|
141
|
+
detail: (id: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").RiseAgent, Error, import("../connectors").RiseAgent, readonly ["rise-apps-sdk", QueryEnvId, "agents", "detail", string]>, "queryFn"> & {
|
|
142
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").RiseAgent, readonly ["rise-apps-sdk", QueryEnvId, "agents", "detail", string], never> | undefined;
|
|
143
|
+
} & {
|
|
144
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "agents", "detail", string], import("../connectors").RiseAgent>;
|
|
145
|
+
};
|
|
146
|
+
chats: (args?: import("./agents").ListChatsQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AgentChatPage, Error, import("../connectors").AgentChatPage, readonly ["rise-apps-sdk", QueryEnvId, "agents", "chats", {
|
|
147
|
+
[x: string]: unknown;
|
|
148
|
+
}]>, "queryFn"> & {
|
|
149
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AgentChatPage, readonly ["rise-apps-sdk", QueryEnvId, "agents", "chats", {
|
|
150
|
+
[x: string]: unknown;
|
|
151
|
+
}], never> | undefined;
|
|
152
|
+
} & {
|
|
153
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "agents", "chats", {
|
|
154
|
+
[x: string]: unknown;
|
|
155
|
+
}], import("../connectors").AgentChatPage>;
|
|
156
|
+
};
|
|
157
|
+
chat: (id: string) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AgentChat, Error, import("../connectors").AgentChat, readonly ["rise-apps-sdk", QueryEnvId, "agents", "chat", string]>, "queryFn"> & {
|
|
158
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AgentChat, readonly ["rise-apps-sdk", QueryEnvId, "agents", "chat", string], never> | undefined;
|
|
159
|
+
} & {
|
|
160
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "agents", "chat", string], import("../connectors").AgentChat>;
|
|
161
|
+
};
|
|
162
|
+
chatMessages: (id: string, args?: import("./agents").GetChatMessagesQueryArgs) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../connectors").AgentChatMessagePage, Error, import("../connectors").AgentChatMessagePage, readonly ["rise-apps-sdk", QueryEnvId, "agents", "chatMessages", string, {
|
|
163
|
+
[x: string]: unknown;
|
|
164
|
+
}]>, "queryFn"> & {
|
|
165
|
+
queryFn?: import("@tanstack/query-core").QueryFunction<import("../connectors").AgentChatMessagePage, readonly ["rise-apps-sdk", QueryEnvId, "agents", "chatMessages", string, {
|
|
166
|
+
[x: string]: unknown;
|
|
167
|
+
}], never> | undefined;
|
|
168
|
+
} & {
|
|
169
|
+
queryKey: import("@tanstack/query-core").DataTag<readonly ["rise-apps-sdk", QueryEnvId, "agents", "chatMessages", string, {
|
|
170
|
+
[x: string]: unknown;
|
|
171
|
+
}], import("../connectors").AgentChatMessagePage>;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
export type QueryLayer = ReturnType<typeof createQueryLayer>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createQueryLayer = createQueryLayer;
|
|
4
|
+
const _internal_1 = require("../_internal");
|
|
5
|
+
const agents_1 = require("../connectors/agents");
|
|
6
|
+
const assets_1 = require("../connectors/assets");
|
|
7
|
+
const flows_1 = require("../connectors/flows");
|
|
8
|
+
const work_1 = require("../connectors/work");
|
|
9
|
+
const agents_2 = require("./agents");
|
|
10
|
+
const assets_2 = require("./assets");
|
|
11
|
+
const flows_2 = require("./flows");
|
|
12
|
+
const work_2 = require("./work");
|
|
13
|
+
// The full query layer bound to one shell resolver — mirrors the connectors'
|
|
14
|
+
// createXConnector(deps) pattern. The default deps resolve the live bridge;
|
|
15
|
+
// tests inject a fake shell. The ready-made live singletons (`flowQueries`,
|
|
16
|
+
// `workQueries`, …) live in their domain files next to their hooks.
|
|
17
|
+
function createQueryLayer(deps = { shell: _internal_1.requireShell }) {
|
|
18
|
+
// Read the env at factory-call time; a missing shell (very early standalone
|
|
19
|
+
// mount) reads as "no environment yet" rather than a render-time throw —
|
|
20
|
+
// the factories disable their queries until an env id appears.
|
|
21
|
+
const getEnvId = () => {
|
|
22
|
+
try {
|
|
23
|
+
return deps.shell().getEnvironment()?.id ?? null;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
flowQueries: (0, flows_2.createFlowQueries)((0, flows_1.createFlowsConnector)(deps), getEnvId),
|
|
31
|
+
workQueries: (0, work_2.createWorkQueries)((0, work_1.createWorkConnector)(deps), getEnvId),
|
|
32
|
+
assetQueries: (0, assets_2.createAssetQueries)((0, assets_1.createAssetsConnector)(deps), getEnvId),
|
|
33
|
+
agentQueries: (0, agents_2.createAgentQueries)((0, agents_1.createAgentsConnector)(deps), getEnvId),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type InfiniteData, type QueryClient, type UseInfiniteQueryResult, type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { ConnectorError } from "../connectors/errors";
|
|
3
|
+
import { type QueryEnvId } from "./keys";
|
|
4
|
+
export interface SdkQueryOptions {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
staleTime?: number;
|
|
7
|
+
gcTime?: number;
|
|
8
|
+
refetchInterval?: number | false;
|
|
9
|
+
refetchOnWindowFocus?: boolean | "always";
|
|
10
|
+
refetchOnMount?: boolean | "always";
|
|
11
|
+
retry?: boolean | number;
|
|
12
|
+
}
|
|
13
|
+
export interface SdkMutationOptions<TData, TVariables> {
|
|
14
|
+
onSuccess?: (data: TData, variables: TVariables) => unknown;
|
|
15
|
+
onError?: (error: ConnectorError, variables: TVariables) => unknown;
|
|
16
|
+
onSettled?: (data: TData | undefined, error: ConnectorError | null, variables: TVariables) => unknown;
|
|
17
|
+
}
|
|
18
|
+
export declare function getLiveEnvId(): QueryEnvId;
|
|
19
|
+
export interface RowsPage {
|
|
20
|
+
items: {
|
|
21
|
+
id: string;
|
|
22
|
+
}[];
|
|
23
|
+
hasMore: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function getNextRowsPageParam<TPage extends RowsPage>(last: TPage, allPages: TPage[], lastPageParam: number): number | undefined;
|
|
26
|
+
export declare function invalidateAppSdkQueries(client: QueryClient, envId?: QueryEnvId): Promise<void>;
|
|
27
|
+
export declare function useEnvSubscription(): void;
|
|
28
|
+
interface BuiltQuery<TData> {
|
|
29
|
+
queryKey: readonly unknown[];
|
|
30
|
+
queryFn?: (context: never) => TData | Promise<TData>;
|
|
31
|
+
enabled?: unknown;
|
|
32
|
+
}
|
|
33
|
+
export declare function useSdkQuery<TData>(built: BuiltQuery<TData>, options?: SdkQueryOptions): UseQueryResult<TData, ConnectorError>;
|
|
34
|
+
interface BuiltInfiniteQuery<TPage> {
|
|
35
|
+
queryKey: readonly unknown[];
|
|
36
|
+
queryFn?: (context: never) => TPage | Promise<TPage>;
|
|
37
|
+
initialPageParam: number;
|
|
38
|
+
getNextPageParam: unknown;
|
|
39
|
+
enabled?: unknown;
|
|
40
|
+
}
|
|
41
|
+
export declare function useSdkInfiniteQuery<TPage>(built: BuiltInfiniteQuery<TPage>, options?: SdkQueryOptions): UseInfiniteQueryResult<InfiniteData<TPage>, ConnectorError>;
|
|
42
|
+
export declare function useSdkMutation<TData, TVariables>(mutationFn: (variables: TVariables) => Promise<TData>, effects: (client: QueryClient, data: TData, variables: TVariables) => void, options?: SdkMutationOptions<TData, TVariables>): import("@tanstack/react-query").UseMutationResult<TData, ConnectorError, TVariables, unknown>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLiveEnvId = getLiveEnvId;
|
|
4
|
+
exports.getNextRowsPageParam = getNextRowsPageParam;
|
|
5
|
+
exports.invalidateAppSdkQueries = invalidateAppSdkQueries;
|
|
6
|
+
exports.useEnvSubscription = useEnvSubscription;
|
|
7
|
+
exports.useSdkQuery = useSdkQuery;
|
|
8
|
+
exports.useSdkInfiniteQuery = useSdkInfiniteQuery;
|
|
9
|
+
exports.useSdkMutation = useSdkMutation;
|
|
10
|
+
// Internal plumbing shared by the per-domain query files: the hook wrappers
|
|
11
|
+
// that bridge the queryOptions factories onto react-query with the resolved
|
|
12
|
+
// per-app client, and the option bags the public hooks accept.
|
|
13
|
+
//
|
|
14
|
+
// The option bags deliberately expose a version-stable subset of react-query's
|
|
15
|
+
// options: naming UseQueryOptions/UseInfiniteQueryOptions in our public d.ts
|
|
16
|
+
// would pin apps to the generic arity of the react-query minor this package
|
|
17
|
+
// was built against. For select/placeholderData/suspense etc., use the
|
|
18
|
+
// factories directly: useQuery(flowQueries.list(args)).
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
21
|
+
const _internal_1 = require("../_internal");
|
|
22
|
+
const accessors_1 = require("../accessors");
|
|
23
|
+
const keys_1 = require("./keys");
|
|
24
|
+
const context_1 = require("./context");
|
|
25
|
+
// The live environment id, tolerant of a missing shell — used by the mutation
|
|
26
|
+
// hooks' invalidation paths (mutations fire outside render, so they read the
|
|
27
|
+
// env at success time rather than subscribing).
|
|
28
|
+
function getLiveEnvId() {
|
|
29
|
+
return (0, accessors_1.getShellEnvironment)()?.id ?? null;
|
|
30
|
+
}
|
|
31
|
+
// Shared getNextPageParam for the domains' skip-paged infinite rows queries.
|
|
32
|
+
// Mirrors the connectors' iterate() bail/advance rule exactly: stop when the
|
|
33
|
+
// server reports no more rows, or when a "full" page turned out to be
|
|
34
|
+
// nothing but rows already seen on an earlier page (no progress — the same
|
|
35
|
+
// no-progress guard iterate() uses to avoid looping forever). Otherwise
|
|
36
|
+
// advance by the page's net-new (deduped) row count rather than raw
|
|
37
|
+
// pageSize, so rows that shift into an already-fetched skip range between
|
|
38
|
+
// page fetches aren't silently skipped over.
|
|
39
|
+
function getNextRowsPageParam(last, allPages, lastPageParam) {
|
|
40
|
+
if (!last.hasMore)
|
|
41
|
+
return undefined;
|
|
42
|
+
const priorIds = new Set();
|
|
43
|
+
for (const page of allPages) {
|
|
44
|
+
if (page === last)
|
|
45
|
+
continue;
|
|
46
|
+
for (const item of page.items)
|
|
47
|
+
priorIds.add(item.id);
|
|
48
|
+
}
|
|
49
|
+
// Count net-new rows, deduping WITHIN the last page too: a row id repeated
|
|
50
|
+
// inside the page must be counted once (matches the connectors' iterate(),
|
|
51
|
+
// which walks the page against a single seen set), or the advance overshoots
|
|
52
|
+
// and skips past the row that shifted into the gap.
|
|
53
|
+
const seen = new Set();
|
|
54
|
+
let newInLast = 0;
|
|
55
|
+
for (const item of last.items) {
|
|
56
|
+
if (priorIds.has(item.id) || seen.has(item.id))
|
|
57
|
+
continue;
|
|
58
|
+
seen.add(item.id);
|
|
59
|
+
newInLast += 1;
|
|
60
|
+
}
|
|
61
|
+
return newInLast === 0 ? undefined : lastPageParam + newInLast;
|
|
62
|
+
}
|
|
63
|
+
// Invalidate every query this SDK owns: the given environment's scope, or all
|
|
64
|
+
// environments when envId is omitted. The escape hatch for writes performed
|
|
65
|
+
// outside the mutation hooks.
|
|
66
|
+
function invalidateAppSdkQueries(client, envId) {
|
|
67
|
+
return client.invalidateQueries({
|
|
68
|
+
queryKey: envId === undefined ? [keys_1.QUERY_KEY_ROOT] : keys_1.queryKeys.all(envId),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
// Re-render when the shell environment changes so the option factories
|
|
72
|
+
// recompute their env-scoped keys. Tolerates a missing shell (very early
|
|
73
|
+
// standalone mount) — the factories read "no env" and stay disabled.
|
|
74
|
+
function useEnvSubscription() {
|
|
75
|
+
let shell = null;
|
|
76
|
+
try {
|
|
77
|
+
shell = (0, _internal_1.requireShell)();
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// no shell installed yet
|
|
81
|
+
}
|
|
82
|
+
const [, setEnv] = (0, react_1.useState)(() => shell?.getEnvironment() ?? null);
|
|
83
|
+
(0, react_1.useEffect)(() => shell?.subscribeEnvironment(setEnv), [shell]);
|
|
84
|
+
}
|
|
85
|
+
function useSdkQuery(built, options) {
|
|
86
|
+
useEnvSubscription();
|
|
87
|
+
const client = (0, context_1.useAppQueryClient)();
|
|
88
|
+
const merged = {
|
|
89
|
+
...built,
|
|
90
|
+
...options,
|
|
91
|
+
enabled: built.enabled === true && (options?.enabled ?? true),
|
|
92
|
+
};
|
|
93
|
+
return (0, react_query_1.useQuery)(merged, client);
|
|
94
|
+
}
|
|
95
|
+
function useSdkInfiniteQuery(built, options) {
|
|
96
|
+
useEnvSubscription();
|
|
97
|
+
const client = (0, context_1.useAppQueryClient)();
|
|
98
|
+
const merged = {
|
|
99
|
+
...built,
|
|
100
|
+
...options,
|
|
101
|
+
enabled: built.enabled === true && (options?.enabled ?? true),
|
|
102
|
+
};
|
|
103
|
+
return (0, react_query_1.useInfiniteQuery)(merged, client);
|
|
104
|
+
}
|
|
105
|
+
function useSdkMutation(mutationFn, effects, options) {
|
|
106
|
+
const client = (0, context_1.useAppQueryClient)();
|
|
107
|
+
return (0, react_query_1.useMutation)({
|
|
108
|
+
mutationFn,
|
|
109
|
+
onSuccess: (data, variables) => {
|
|
110
|
+
effects(client, data, variables);
|
|
111
|
+
return options?.onSuccess?.(data, variables);
|
|
112
|
+
},
|
|
113
|
+
onError: (error, variables) => options?.onError?.(error, variables),
|
|
114
|
+
onSettled: (data, error, variables) => options?.onSettled?.(data, error, variables),
|
|
115
|
+
}, client);
|
|
116
|
+
}
|