@datatechsolutions/ui 2.11.80 → 2.11.82
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/astrlabe/contracts.d.mts +24 -1
- package/dist/astrlabe/contracts.d.ts +24 -1
- package/dist/astrlabe/index.d.mts +25 -84
- package/dist/astrlabe/index.d.ts +25 -84
- package/dist/astrlabe/index.js +175 -4570
- package/dist/astrlabe/index.js.map +1 -1
- package/dist/astrlabe/index.mjs +3 -4535
- package/dist/astrlabe/index.mjs.map +1 -1
- package/dist/astrlabe/workflow-canvas.d.mts +69 -5
- package/dist/astrlabe/workflow-canvas.d.ts +69 -5
- package/dist/chunk-6PBTB5ZX.js +165 -0
- package/dist/chunk-6PBTB5ZX.js.map +1 -0
- package/dist/chunk-HAZP5J67.mjs +4781 -0
- package/dist/chunk-HAZP5J67.mjs.map +1 -0
- package/dist/chunk-HZ4LOVHM.js +46 -0
- package/dist/chunk-HZ4LOVHM.js.map +1 -0
- package/dist/chunk-K4QJV3GC.js +4825 -0
- package/dist/chunk-K4QJV3GC.js.map +1 -0
- package/dist/chunk-UHHPBREK.mjs +135 -0
- package/dist/chunk-UHHPBREK.mjs.map +1 -0
- package/dist/chunk-ZJPNP2YW.mjs +44 -0
- package/dist/chunk-ZJPNP2YW.mjs.map +1 -0
- package/dist/{workflow-canvas-NSxfr5dy.d.ts → index-AioB90qq.d.mts} +2 -67
- package/dist/{workflow-canvas-D4928AfA.d.mts → index-D5ai0cGZ.d.ts} +2 -67
- package/dist/platform/index.d.mts +41 -0
- package/dist/platform/index.d.ts +41 -0
- package/dist/platform/index.js +237 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/index.mjs +109 -0
- package/dist/platform/index.mjs.map +1 -0
- package/dist/platform/pages/index.d.mts +272 -0
- package/dist/platform/pages/index.d.ts +272 -0
- package/dist/platform/pages/index.js +1793 -0
- package/dist/platform/pages/index.js.map +1 -0
- package/dist/platform/pages/index.mjs +1777 -0
- package/dist/platform/pages/index.mjs.map +1 -0
- package/dist/platform/rbac.d.mts +41 -0
- package/dist/platform/rbac.d.ts +41 -0
- package/dist/platform/rbac.js +13 -0
- package/dist/platform/rbac.js.map +1 -0
- package/dist/platform/rbac.mjs +4 -0
- package/dist/platform/rbac.mjs.map +1 -0
- package/dist/platform/utils/index.d.mts +32 -0
- package/dist/platform/utils/index.d.ts +32 -0
- package/dist/platform/utils/index.js +131 -0
- package/dist/platform/utils/index.js.map +1 -0
- package/dist/platform/utils/index.mjs +119 -0
- package/dist/platform/utils/index.mjs.map +1 -0
- package/dist/platform/windsock-admin-client.d.mts +57 -0
- package/dist/platform/windsock-admin-client.d.ts +57 -0
- package/dist/platform/windsock-admin-client.js +125 -0
- package/dist/platform/windsock-admin-client.js.map +1 -0
- package/dist/platform/windsock-admin-client.mjs +4 -0
- package/dist/platform/windsock-admin-client.mjs.map +1 -0
- package/dist/rule-form-F5jBOeqk.d.mts +79 -0
- package/dist/rule-form-F5jBOeqk.d.ts +79 -0
- package/package.json +28 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// src/platform/utils/format-duration.ts
|
|
5
|
+
function formatDurationMs(ms) {
|
|
6
|
+
if (ms === null || ms === void 0 || Number.isNaN(ms)) return "\u2014";
|
|
7
|
+
if (ms < 0) return "\u2014";
|
|
8
|
+
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
9
|
+
const totalSeconds = ms / 1e3;
|
|
10
|
+
if (totalSeconds < 60) return `${totalSeconds.toFixed(totalSeconds < 10 ? 2 : 1)}s`;
|
|
11
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
12
|
+
const seconds = Math.round(totalSeconds - minutes * 60);
|
|
13
|
+
if (minutes < 60) return seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
|
|
14
|
+
const hours = Math.floor(minutes / 60);
|
|
15
|
+
const remainingMinutes = minutes - hours * 60;
|
|
16
|
+
return remainingMinutes === 0 ? `${hours}h` : `${hours}h ${remainingMinutes}m`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/platform/utils/json-parse.ts
|
|
20
|
+
function tryParseJson(value) {
|
|
21
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
22
|
+
if (!raw) return void 0;
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(raw);
|
|
25
|
+
} catch {
|
|
26
|
+
return void 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function tryParseJsonObject(value) {
|
|
30
|
+
const parsed = tryParseJson(value);
|
|
31
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
32
|
+
return parsed;
|
|
33
|
+
}
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
function tryParseJsonArray(value) {
|
|
37
|
+
const parsed = tryParseJson(value);
|
|
38
|
+
if (Array.isArray(parsed)) {
|
|
39
|
+
return parsed;
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/platform/utils/tool-category.ts
|
|
45
|
+
var TOOL_CATEGORY_VALUES = [
|
|
46
|
+
"search",
|
|
47
|
+
"code",
|
|
48
|
+
"file",
|
|
49
|
+
"web",
|
|
50
|
+
"math",
|
|
51
|
+
"custom"
|
|
52
|
+
];
|
|
53
|
+
var TOOL_CATEGORY_SET = new Set(TOOL_CATEGORY_VALUES);
|
|
54
|
+
function parseToolCategory(value) {
|
|
55
|
+
const str = typeof value === "string" ? value.trim() : "";
|
|
56
|
+
return TOOL_CATEGORY_SET.has(str) ? str : void 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/platform/utils/workflow-graph-adapter.ts
|
|
60
|
+
function assertEntityConfig(node) {
|
|
61
|
+
if (node.type !== "entity") return node;
|
|
62
|
+
const config = node.data.config;
|
|
63
|
+
if (!config || config.type !== "entity") {
|
|
64
|
+
throw new Error(`Entity node ${node.id} is missing entity config`);
|
|
65
|
+
}
|
|
66
|
+
const entityConfig = config;
|
|
67
|
+
if (!entityConfig.entityMasterId || entityConfig.entityMasterId.trim().length === 0) {
|
|
68
|
+
throw new Error(`Entity node ${node.id} is missing required entityMasterId`);
|
|
69
|
+
}
|
|
70
|
+
return node;
|
|
71
|
+
}
|
|
72
|
+
function adaptWorkflowGraphToUi(graph) {
|
|
73
|
+
const nodes = graph.nodes.map((node) => assertEntityConfig(node));
|
|
74
|
+
return {
|
|
75
|
+
nodes,
|
|
76
|
+
edges: graph.edges,
|
|
77
|
+
viewport: graph.viewport
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/platform/utils/lambda-endpoint.ts
|
|
82
|
+
var trimTrailingSlash = (value) => value.replace(/\/$/, "");
|
|
83
|
+
function getLambdaApiBase() {
|
|
84
|
+
const directBase = undefined.VITE_LAMBDA_CLIENT_BASE;
|
|
85
|
+
if (directBase && directBase.trim().length > 0) return trimTrailingSlash(directBase);
|
|
86
|
+
const gatewayBase = undefined.VITE_API_GATEWAY_URL;
|
|
87
|
+
if (gatewayBase && gatewayBase.trim().length > 0) return trimTrailingSlash(gatewayBase);
|
|
88
|
+
throw new Error(
|
|
89
|
+
"Missing workflow API base URL. Set VITE_LAMBDA_CLIENT_BASE or VITE_API_GATEWAY_URL."
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function buildLambdaApiUrl(path) {
|
|
93
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
94
|
+
return `${getLambdaApiBase()}${normalizedPath}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// src/platform/utils/auth-app.ts
|
|
98
|
+
function requireEnv(name) {
|
|
99
|
+
const rawValue = undefined[name];
|
|
100
|
+
if (typeof rawValue !== "string") {
|
|
101
|
+
throw new Error(`Missing required environment variable: ${name}`);
|
|
102
|
+
}
|
|
103
|
+
const value = rawValue.trim();
|
|
104
|
+
if (!value) {
|
|
105
|
+
throw new Error(`Missing required environment variable: ${name}`);
|
|
106
|
+
}
|
|
107
|
+
return value.replace(/\/+$/, "");
|
|
108
|
+
}
|
|
109
|
+
function getAuthAppUrl() {
|
|
110
|
+
return requireEnv("VITE_AUTH_APP_URL");
|
|
111
|
+
}
|
|
112
|
+
function buildHostedAuthUrl(path, search = "") {
|
|
113
|
+
const authAppUrl = getAuthAppUrl();
|
|
114
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
115
|
+
const normalizedSearch = search.startsWith("?") ? search : search ? `?${search}` : "";
|
|
116
|
+
return `${authAppUrl}${normalizedPath}${normalizedSearch}`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
exports.TOOL_CATEGORY_VALUES = TOOL_CATEGORY_VALUES;
|
|
120
|
+
exports.adaptWorkflowGraphToUi = adaptWorkflowGraphToUi;
|
|
121
|
+
exports.buildHostedAuthUrl = buildHostedAuthUrl;
|
|
122
|
+
exports.buildLambdaApiUrl = buildLambdaApiUrl;
|
|
123
|
+
exports.formatDurationMs = formatDurationMs;
|
|
124
|
+
exports.getAuthAppUrl = getAuthAppUrl;
|
|
125
|
+
exports.getLambdaApiBase = getLambdaApiBase;
|
|
126
|
+
exports.parseToolCategory = parseToolCategory;
|
|
127
|
+
exports.tryParseJson = tryParseJson;
|
|
128
|
+
exports.tryParseJsonArray = tryParseJsonArray;
|
|
129
|
+
exports.tryParseJsonObject = tryParseJsonObject;
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/platform/utils/format-duration.ts","../../../src/platform/utils/json-parse.ts","../../../src/platform/utils/tool-category.ts","../../../src/platform/utils/workflow-graph-adapter.ts","../../../src/platform/utils/lambda-endpoint.ts","../../../src/platform/utils/auth-app.ts"],"names":[],"mappings":";;;AACO,SAAS,iBAAiB,EAAA,EAAuC;AACtE,EAAA,IA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CAAA,EAAG,gBAAA,EAAkB,CAAA,EAAG,cAAc,CAAA,CAAA;AAC/C;;;ACjBA,SAAS,WAAW,IAAA,EAAsB;AACxC,EAAA,MAAM,QAAA,GAAW,SAAY,CAAI,IAAI,CAAA;AACrC,EAAA,IAAI,OAAO,aAAa,QAAA,EAAU;AAChC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,uCAAA,EAA0C,IAAI,CAAA,CAAE,CAAA;AAAA,EAClE;AAEA,EAAA,MAAM,KAAA,GAAQ,SAAS,IAAA,EAAK;AAC5B,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,uCAAA,EAA0C,IAAI,CAAA,CAAE,CAAA;AAAA,EAClE;AAEA,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA;AACjC;AAEO,SAAS,aAAA,GAAwB;AACtC,EAAA,OAAO,WAAW,mBAAmB,CAAA;AACvC;AAEO,SAAS,kBAAA,CAAmB,IAAA,EAAc,MAAA,GAAS,EAAA,EAAY;AACpE,EAAA,MAAM,aAAa,aAAA,EAAc;AACjC,EAAA,MAAM,iBAAiB,IAAA,CAAK,UAAA,CAAW,GAAG,CAAA,GAAI,IAAA,GAAO,IAAI,IAAI,CAAA,CAAA;AAC7D,EAAA,MAAM,gBAAA,GAAmB,OAAO,UAAA,CAAW,GAAG,IAC1C,MAAA,GACA,MAAA,GACE,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,GACV,EAAA;AAEN,EAAA,OAAO,CAAA,EAAG,UAAU,CAAA,EAAG,cAAc,GAAG,gBAAgB,CAAA,CAAA;AAC1D","file":"index.js","sourcesContent":["/** Formats a millisecond count as a short, human-readable duration string. */\nexport function formatDurationMs(ms: number | null | undefined): string {\n if (ms === null || ms === undefined || Number.isNaN(ms)) return '—'\n if (ms < 0) return '—'\n if (ms < 1_000) return `${Math.round(ms)}ms`\n\n const totalSeconds = ms / 1_000\n if (totalSeconds < 60) return `${totalSeconds.toFixed(totalSeconds < 10 ? 2 : 1)}s`\n\n const minutes = Math.floor(totalSeconds / 60)\n const seconds = Math.round(totalSeconds - minutes * 60)\n if (minutes < 60) return seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`\n\n const hours = Math.floor(minutes / 60)\n const remainingMinutes = minutes - hours * 60\n return remainingMinutes === 0 ? `${hours}h` : `${hours}h ${remainingMinutes}m`\n}\n","/**\n * Parses a JSON string into a typed value, returning undefined (not throwing)\n * on empty input or malformed JSON. Used by form builders where the user types\n * JSON into a textarea and we want to surface a friendly \"couldn't parse\" state\n * rather than crashing the submit handler.\n */\nexport function tryParseJson<T = unknown>(value: FormDataEntryValue | string | null | undefined): T | undefined {\n const raw = typeof value === 'string' ? value.trim() : ''\n if (!raw) return undefined\n try {\n return JSON.parse(raw) as T\n } catch {\n return undefined\n }\n}\n\n/** Parses JSON into an object record. Returns undefined if the result is not a plain object. */\nexport function tryParseJsonObject(value: FormDataEntryValue | string | null | undefined): Record<string, unknown> | undefined {\n const parsed = tryParseJson<unknown>(value)\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>\n }\n return undefined\n}\n\n/** Parses JSON into an array of records. Returns undefined if not a plain array. */\nexport function tryParseJsonArray(value: FormDataEntryValue | string | null | undefined): Array<Record<string, unknown>> | undefined {\n const parsed = tryParseJson<unknown>(value)\n if (Array.isArray(parsed)) {\n return parsed as Array<Record<string, unknown>>\n }\n return undefined\n}\n","export type ToolCategory = 'search' | 'code' | 'file' | 'web' | 'math' | 'custom'\n\nexport const TOOL_CATEGORY_VALUES: readonly ToolCategory[] = [\n 'search',\n 'code',\n 'file',\n 'web',\n 'math',\n 'custom',\n] as const\n\nconst TOOL_CATEGORY_SET = new Set<ToolCategory>(TOOL_CATEGORY_VALUES)\n\n/** Narrows a form value to a ToolCategory, returning undefined if not one of the known values. */\nexport function parseToolCategory(value: FormDataEntryValue | null | undefined): ToolCategory | undefined {\n const str = typeof value === 'string' ? value.trim() : ''\n return TOOL_CATEGORY_SET.has(str as ToolCategory) ? (str as ToolCategory) : undefined\n}\n","import type { WorkflowGraph as SharedWorkflowGraph } from '@datatechsolutions/shared-domain/ports/workflow'\nimport type {\n WorkflowGraph as UiWorkflowGraph,\n WorkflowNode as UiWorkflowNode,\n EntityNodeConfig as UiEntityNodeConfig,\n} from '../../astrlabe/contracts'\n\nfunction assertEntityConfig(node: UiWorkflowNode): UiWorkflowNode {\n if (node.type !== 'entity') return node\n\n const config = node.data.config\n if (!config || config.type !== 'entity') {\n throw new Error(`Entity node ${node.id} is missing entity config`)\n }\n\n const entityConfig = config as UiEntityNodeConfig\n if (!entityConfig.entityMasterId || entityConfig.entityMasterId.trim().length === 0) {\n throw new Error(`Entity node ${node.id} is missing required entityMasterId`)\n }\n\n return node\n}\n\nexport function adaptWorkflowGraphToUi(graph: SharedWorkflowGraph): UiWorkflowGraph {\n const nodes = graph.nodes.map((node) => assertEntityConfig(node as unknown as UiWorkflowNode))\n return {\n nodes,\n edges: graph.edges as UiWorkflowGraph['edges'],\n viewport: graph.viewport as UiWorkflowGraph['viewport'],\n }\n}\n","/// <reference types=\"vite/client\" />\n\nconst trimTrailingSlash = (value: string): string => value.replace(/\\/$/, '')\n\nexport function getLambdaApiBase(): string {\n const directBase = import.meta.env.VITE_LAMBDA_CLIENT_BASE\n if (directBase && directBase.trim().length > 0) return trimTrailingSlash(directBase)\n\n const gatewayBase = import.meta.env.VITE_API_GATEWAY_URL\n if (gatewayBase && gatewayBase.trim().length > 0) return trimTrailingSlash(gatewayBase)\n\n throw new Error(\n 'Missing workflow API base URL. Set VITE_LAMBDA_CLIENT_BASE or VITE_API_GATEWAY_URL.'\n )\n}\n\nexport function buildLambdaApiUrl(path: string): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n return `${getLambdaApiBase()}${normalizedPath}`\n}\n","/// <reference types=\"vite/client\" />\n\nfunction requireEnv(name: string): string {\n const rawValue = import.meta.env[name]\n if (typeof rawValue !== 'string') {\n throw new Error(`Missing required environment variable: ${name}`)\n }\n\n const value = rawValue.trim()\n if (!value) {\n throw new Error(`Missing required environment variable: ${name}`)\n }\n\n return value.replace(/\\/+$/, '')\n}\n\nexport function getAuthAppUrl(): string {\n return requireEnv('VITE_AUTH_APP_URL')\n}\n\nexport function buildHostedAuthUrl(path: string, search = ''): string {\n const authAppUrl = getAuthAppUrl()\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n const normalizedSearch = search.startsWith('?')\n ? search\n : search\n ? `?${search}`\n : ''\n\n return `${authAppUrl}${normalizedPath}${normalizedSearch}`\n}\n"]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/platform/utils/format-duration.ts
|
|
3
|
+
function formatDurationMs(ms) {
|
|
4
|
+
if (ms === null || ms === void 0 || Number.isNaN(ms)) return "\u2014";
|
|
5
|
+
if (ms < 0) return "\u2014";
|
|
6
|
+
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
7
|
+
const totalSeconds = ms / 1e3;
|
|
8
|
+
if (totalSeconds < 60) return `${totalSeconds.toFixed(totalSeconds < 10 ? 2 : 1)}s`;
|
|
9
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
10
|
+
const seconds = Math.round(totalSeconds - minutes * 60);
|
|
11
|
+
if (minutes < 60) return seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
|
|
12
|
+
const hours = Math.floor(minutes / 60);
|
|
13
|
+
const remainingMinutes = minutes - hours * 60;
|
|
14
|
+
return remainingMinutes === 0 ? `${hours}h` : `${hours}h ${remainingMinutes}m`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/platform/utils/json-parse.ts
|
|
18
|
+
function tryParseJson(value) {
|
|
19
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
20
|
+
if (!raw) return void 0;
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(raw);
|
|
23
|
+
} catch {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function tryParseJsonObject(value) {
|
|
28
|
+
const parsed = tryParseJson(value);
|
|
29
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
30
|
+
return parsed;
|
|
31
|
+
}
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
function tryParseJsonArray(value) {
|
|
35
|
+
const parsed = tryParseJson(value);
|
|
36
|
+
if (Array.isArray(parsed)) {
|
|
37
|
+
return parsed;
|
|
38
|
+
}
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/platform/utils/tool-category.ts
|
|
43
|
+
var TOOL_CATEGORY_VALUES = [
|
|
44
|
+
"search",
|
|
45
|
+
"code",
|
|
46
|
+
"file",
|
|
47
|
+
"web",
|
|
48
|
+
"math",
|
|
49
|
+
"custom"
|
|
50
|
+
];
|
|
51
|
+
var TOOL_CATEGORY_SET = new Set(TOOL_CATEGORY_VALUES);
|
|
52
|
+
function parseToolCategory(value) {
|
|
53
|
+
const str = typeof value === "string" ? value.trim() : "";
|
|
54
|
+
return TOOL_CATEGORY_SET.has(str) ? str : void 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/platform/utils/workflow-graph-adapter.ts
|
|
58
|
+
function assertEntityConfig(node) {
|
|
59
|
+
if (node.type !== "entity") return node;
|
|
60
|
+
const config = node.data.config;
|
|
61
|
+
if (!config || config.type !== "entity") {
|
|
62
|
+
throw new Error(`Entity node ${node.id} is missing entity config`);
|
|
63
|
+
}
|
|
64
|
+
const entityConfig = config;
|
|
65
|
+
if (!entityConfig.entityMasterId || entityConfig.entityMasterId.trim().length === 0) {
|
|
66
|
+
throw new Error(`Entity node ${node.id} is missing required entityMasterId`);
|
|
67
|
+
}
|
|
68
|
+
return node;
|
|
69
|
+
}
|
|
70
|
+
function adaptWorkflowGraphToUi(graph) {
|
|
71
|
+
const nodes = graph.nodes.map((node) => assertEntityConfig(node));
|
|
72
|
+
return {
|
|
73
|
+
nodes,
|
|
74
|
+
edges: graph.edges,
|
|
75
|
+
viewport: graph.viewport
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/platform/utils/lambda-endpoint.ts
|
|
80
|
+
var trimTrailingSlash = (value) => value.replace(/\/$/, "");
|
|
81
|
+
function getLambdaApiBase() {
|
|
82
|
+
const directBase = import.meta.env.VITE_LAMBDA_CLIENT_BASE;
|
|
83
|
+
if (directBase && directBase.trim().length > 0) return trimTrailingSlash(directBase);
|
|
84
|
+
const gatewayBase = import.meta.env.VITE_API_GATEWAY_URL;
|
|
85
|
+
if (gatewayBase && gatewayBase.trim().length > 0) return trimTrailingSlash(gatewayBase);
|
|
86
|
+
throw new Error(
|
|
87
|
+
"Missing workflow API base URL. Set VITE_LAMBDA_CLIENT_BASE or VITE_API_GATEWAY_URL."
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
function buildLambdaApiUrl(path) {
|
|
91
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
92
|
+
return `${getLambdaApiBase()}${normalizedPath}`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/platform/utils/auth-app.ts
|
|
96
|
+
function requireEnv(name) {
|
|
97
|
+
const rawValue = import.meta.env[name];
|
|
98
|
+
if (typeof rawValue !== "string") {
|
|
99
|
+
throw new Error(`Missing required environment variable: ${name}`);
|
|
100
|
+
}
|
|
101
|
+
const value = rawValue.trim();
|
|
102
|
+
if (!value) {
|
|
103
|
+
throw new Error(`Missing required environment variable: ${name}`);
|
|
104
|
+
}
|
|
105
|
+
return value.replace(/\/+$/, "");
|
|
106
|
+
}
|
|
107
|
+
function getAuthAppUrl() {
|
|
108
|
+
return requireEnv("VITE_AUTH_APP_URL");
|
|
109
|
+
}
|
|
110
|
+
function buildHostedAuthUrl(path, search = "") {
|
|
111
|
+
const authAppUrl = getAuthAppUrl();
|
|
112
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
113
|
+
const normalizedSearch = search.startsWith("?") ? search : search ? `?${search}` : "";
|
|
114
|
+
return `${authAppUrl}${normalizedPath}${normalizedSearch}`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export { TOOL_CATEGORY_VALUES, adaptWorkflowGraphToUi, buildHostedAuthUrl, buildLambdaApiUrl, formatDurationMs, getAuthAppUrl, getLambdaApiBase, parseToolCategory, tryParseJson, tryParseJsonArray, tryParseJsonObject };
|
|
118
|
+
//# sourceMappingURL=index.mjs.map
|
|
119
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/platform/utils/format-duration.ts","../../../src/platform/utils/json-parse.ts","../../../src/platform/utils/tool-category.ts","../../../src/platform/utils/workflow-graph-adapter.ts","../../../src/platform/utils/lambda-endpoint.ts","../../../src/platform/utils/auth-app.ts"],"names":[],"mappings":";AACO,SAAS,iBAAiB,EAAA,EAAuC;AACtE,EAAA,IAAI,EAAA,KAAO,QAAQ,EAAA,KAAO,MAAA,IAAa,OAAO,KAAA,CAAM,EAAE,GAAG,OAAO,QAAA;AAChE,EAAA,IAAI,EAAA,GAAK,GAAG,OAAO,QAAA;AACnB,EAAA,IAAI,KAAK,GAAA,EAAO,OAAO,GAAG,IAAA,CAAK,KAAA,CAAM,EAAE,CAAC,CAAA,EAAA,CAAA;AAExC,EAAA,MAAM,eAAe,EAAA,GAAK,GAAA;AAC1B,EAAA,IAAI,YAAA,GAAe,EAAA,EAAI,OAAO,CAAA,EAAG,YAAA,CAAa,QAAQ,YAAA,GAAe,EAAA,GAAK,CAAA,GAAI,CAAC,CAAC,CAAA,CAAA,CAAA;AAEhF,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,YAAA,GAAe,EAAE,CAAA;AAC5C,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,YAAA,GAAe,UA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AEO,SAAS,aAAA,GAAwB;AACtC,EAAA,OAAO,WAAW,mBAAmB,CAAA;AACvC;AAEO,SAAS,kBAAA,CAAmB,IAAA,EAAc,MAAA,GAAS,EAAA,EAAY;AACpE,EAAA,MAAM,aAAa,aAAA,EAAc;AACjC,EAAA,MAAM,iBAAiB,IAAA,CAAK,UAAA,CAAW,GAAG,CAAA,GAAI,IAAA,GAAO,IAAI,IAAI,CAAA,CAAA;AAC7D,EAAA,MAAM,gBAAA,GAAmB,OAAO,UAAA,CAAW,GAAG,IAC1C,MAAA,GACA,MAAA,GACE,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,GACV,EAAA;AAEN,EAAA,OAAO,CAAA,EAAG,UAAU,CAAA,EAAG,cAAc,GAAG,gBAAgB,CAAA,CAAA;AAC1D","file":"index.mjs","sourcesContent":["/** Formats a millisecond count as a short, human-readable duration string. */\nexport function formatDurationMs(ms: number | null | undefined): string {\n if (ms === null || ms === undefined || Number.isNaN(ms)) return '—'\n if (ms < 0) return '—'\n if (ms < 1_000) return `${Math.round(ms)}ms`\n\n const totalSeconds = ms / 1_000\n if (totalSeconds < 60) return `${totalSeconds.toFixed(totalSeconds < 10 ? 2 : 1)}s`\n\n const minutes = Math.floor(totalSeconds / 60)\n const seconds = Math.round(totalSeconds - minutes * 60)\n if (minutes < 60) return seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`\n\n const hours = Math.floor(minutes / 60)\n const remainingMinutes = minutes - hours * 60\n return remainingMinutes === 0 ? `${hours}h` : `${hours}h ${remainingMinutes}m`\n}\n","/**\n * Parses a JSON string into a typed value, returning undefined (not throwing)\n * on empty input or malformed JSON. Used by form builders where the user types\n * JSON into a textarea and we want to surface a friendly \"couldn't parse\" state\n * rather than crashing the submit handler.\n */\nexport function tryParseJson<T = unknown>(value: FormDataEntryValue | string | null | undefined): T | undefined {\n const raw = typeof value === 'string' ? value.trim() : ''\n if (!raw) return undefined\n try {\n return JSON.parse(raw) as T\n } catch {\n return undefined\n }\n}\n\n/** Parses JSON into an object record. Returns undefined if the result is not a plain object. */\nexport function tryParseJsonObject(value: FormDataEntryValue | string | null | undefined): Record<string, unknown> | undefined {\n const parsed = tryParseJson<unknown>(value)\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>\n }\n return undefined\n}\n\n/** Parses JSON into an array of records. Returns undefined if not a plain array. */\nexport function tryParseJsonArray(value: FormDataEntryValue | string | null | undefined): Array<Record<string, unknown>> | undefined {\n const parsed = tryParseJson<unknown>(value)\n if (Array.isArray(parsed)) {\n return parsed as Array<Record<string, unknown>>\n }\n return undefined\n}\n","export type ToolCategory = 'search' | 'code' | 'file' | 'web' | 'math' | 'custom'\n\nexport const TOOL_CATEGORY_VALUES: readonly ToolCategory[] = [\n 'search',\n 'code',\n 'file',\n 'web',\n 'math',\n 'custom',\n] as const\n\nconst TOOL_CATEGORY_SET = new Set<ToolCategory>(TOOL_CATEGORY_VALUES)\n\n/** Narrows a form value to a ToolCategory, returning undefined if not one of the known values. */\nexport function parseToolCategory(value: FormDataEntryValue | null | undefined): ToolCategory | undefined {\n const str = typeof value === 'string' ? value.trim() : ''\n return TOOL_CATEGORY_SET.has(str as ToolCategory) ? (str as ToolCategory) : undefined\n}\n","import type { WorkflowGraph as SharedWorkflowGraph } from '@datatechsolutions/shared-domain/ports/workflow'\nimport type {\n WorkflowGraph as UiWorkflowGraph,\n WorkflowNode as UiWorkflowNode,\n EntityNodeConfig as UiEntityNodeConfig,\n} from '../../astrlabe/contracts'\n\nfunction assertEntityConfig(node: UiWorkflowNode): UiWorkflowNode {\n if (node.type !== 'entity') return node\n\n const config = node.data.config\n if (!config || config.type !== 'entity') {\n throw new Error(`Entity node ${node.id} is missing entity config`)\n }\n\n const entityConfig = config as UiEntityNodeConfig\n if (!entityConfig.entityMasterId || entityConfig.entityMasterId.trim().length === 0) {\n throw new Error(`Entity node ${node.id} is missing required entityMasterId`)\n }\n\n return node\n}\n\nexport function adaptWorkflowGraphToUi(graph: SharedWorkflowGraph): UiWorkflowGraph {\n const nodes = graph.nodes.map((node) => assertEntityConfig(node as unknown as UiWorkflowNode))\n return {\n nodes,\n edges: graph.edges as UiWorkflowGraph['edges'],\n viewport: graph.viewport as UiWorkflowGraph['viewport'],\n }\n}\n","/// <reference types=\"vite/client\" />\n\nconst trimTrailingSlash = (value: string): string => value.replace(/\\/$/, '')\n\nexport function getLambdaApiBase(): string {\n const directBase = import.meta.env.VITE_LAMBDA_CLIENT_BASE\n if (directBase && directBase.trim().length > 0) return trimTrailingSlash(directBase)\n\n const gatewayBase = import.meta.env.VITE_API_GATEWAY_URL\n if (gatewayBase && gatewayBase.trim().length > 0) return trimTrailingSlash(gatewayBase)\n\n throw new Error(\n 'Missing workflow API base URL. Set VITE_LAMBDA_CLIENT_BASE or VITE_API_GATEWAY_URL.'\n )\n}\n\nexport function buildLambdaApiUrl(path: string): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n return `${getLambdaApiBase()}${normalizedPath}`\n}\n","/// <reference types=\"vite/client\" />\n\nfunction requireEnv(name: string): string {\n const rawValue = import.meta.env[name]\n if (typeof rawValue !== 'string') {\n throw new Error(`Missing required environment variable: ${name}`)\n }\n\n const value = rawValue.trim()\n if (!value) {\n throw new Error(`Missing required environment variable: ${name}`)\n }\n\n return value.replace(/\\/+$/, '')\n}\n\nexport function getAuthAppUrl(): string {\n return requireEnv('VITE_AUTH_APP_URL')\n}\n\nexport function buildHostedAuthUrl(path: string, search = ''): string {\n const authAppUrl = getAuthAppUrl()\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n const normalizedSearch = search.startsWith('?')\n ? search\n : search\n ? `?${search}`\n : ''\n\n return `${authAppUrl}${normalizedPath}${normalizedSearch}`\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AuthOrganizationDomain, AuthOrganizationRole, AdminCreateOrganizationInput, AuthOrganization, AdminCreateInvitationInput, AdminCreatePermissionInput, AdminPermission, AdminCreateUserInput, AdminUserSummary, AuthOrganizationInvitation, AdminOrganizationMember, AdminListParams, AdminListResult, AdminClient, AdminUpdateOrganizationInput, AdminUpdatePermissionInput, AdminUpdateUserInput } from '@datatechsolutions/shared-domain';
|
|
2
|
+
|
|
3
|
+
declare function setWindsockAdminClient(client: AdminClient, issuer: string, authFetch: typeof fetch): void;
|
|
4
|
+
declare function listUsers(params?: AdminListParams): Promise<AdminListResult<AdminUserSummary>>;
|
|
5
|
+
declare function createUser(data: AdminCreateUserInput): Promise<AdminUserSummary>;
|
|
6
|
+
declare function updateUser(userId: string, data: AdminUpdateUserInput): Promise<void>;
|
|
7
|
+
declare function deleteUser(userId: string): Promise<void>;
|
|
8
|
+
declare function resetUserPassword(userId: string, password: string): Promise<void>;
|
|
9
|
+
declare function listOrganizations(): Promise<AuthOrganization[]>;
|
|
10
|
+
declare function createOrganization(data: AdminCreateOrganizationInput): Promise<AuthOrganization>;
|
|
11
|
+
declare function updateOrganization(organizationId: string, data: AdminUpdateOrganizationInput): Promise<AuthOrganization>;
|
|
12
|
+
declare function deleteOrganization(organizationId: string): Promise<void>;
|
|
13
|
+
declare function listOrganizationMembers(organizationId: string): Promise<AdminOrganizationMember[]>;
|
|
14
|
+
declare function addOrganizationMember(organizationId: string, userId: string, role?: AuthOrganizationRole): Promise<void>;
|
|
15
|
+
declare function removeOrganizationMember(organizationId: string, userId: string): Promise<void>;
|
|
16
|
+
declare function listOrganizationInvitations(organizationId: string): Promise<AuthOrganizationInvitation[]>;
|
|
17
|
+
declare function createOrganizationInvitation(organizationId: string, data: AdminCreateInvitationInput): Promise<void>;
|
|
18
|
+
declare function listOrganizationDomains(organizationId: string): Promise<AuthOrganizationDomain[]>;
|
|
19
|
+
declare function addOrganizationDomain(organizationId: string, domain: string): Promise<AuthOrganizationDomain>;
|
|
20
|
+
declare function verifyOrganizationDomain(organizationId: string, domain: string): Promise<void>;
|
|
21
|
+
declare function listPermissions(): Promise<AdminPermission[]>;
|
|
22
|
+
declare function createPermission(data: AdminCreatePermissionInput): Promise<AdminPermission>;
|
|
23
|
+
declare function updatePermission(permissionId: string, data: AdminUpdatePermissionInput): Promise<void>;
|
|
24
|
+
declare function deletePermission(permissionId: string): Promise<void>;
|
|
25
|
+
declare function getUserPermissions(userId: string): Promise<AdminPermission[]>;
|
|
26
|
+
declare function setUserPermissions(userId: string, permissionIds: string[]): Promise<void>;
|
|
27
|
+
type SecretSummary = {
|
|
28
|
+
secretId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
secretType: string;
|
|
31
|
+
description: string | null;
|
|
32
|
+
expiresAt: string | null;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
};
|
|
37
|
+
type SecretDetail = SecretSummary & {
|
|
38
|
+
value?: string;
|
|
39
|
+
};
|
|
40
|
+
type CreateSecretInput = {
|
|
41
|
+
name: string;
|
|
42
|
+
value: string;
|
|
43
|
+
secretType?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
leaseTtlSeconds?: number;
|
|
46
|
+
};
|
|
47
|
+
type UpdateSecretInput = {
|
|
48
|
+
value: string;
|
|
49
|
+
leaseTtlSeconds?: number;
|
|
50
|
+
};
|
|
51
|
+
declare function listSecrets(organizationId: string): Promise<SecretSummary[]>;
|
|
52
|
+
declare function getSecret(organizationId: string, secretId: string): Promise<SecretDetail>;
|
|
53
|
+
declare function createSecret(organizationId: string, input: CreateSecretInput): Promise<SecretSummary>;
|
|
54
|
+
declare function rotateSecret(organizationId: string, secretId: string, input: UpdateSecretInput): Promise<SecretSummary>;
|
|
55
|
+
declare function disableSecret(organizationId: string, secretId: string): Promise<void>;
|
|
56
|
+
|
|
57
|
+
export { type CreateSecretInput, type SecretDetail, type SecretSummary, type UpdateSecretInput, addOrganizationDomain, addOrganizationMember, createOrganization, createOrganizationInvitation, createPermission, createSecret, createUser, deleteOrganization, deletePermission, deleteUser, disableSecret, getSecret, getUserPermissions, listOrganizationDomains, listOrganizationInvitations, listOrganizationMembers, listOrganizations, listPermissions, listSecrets, listUsers, removeOrganizationMember, resetUserPassword, rotateSecret, setUserPermissions, setWindsockAdminClient, updateOrganization, updatePermission, updateUser, verifyOrganizationDomain };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AuthOrganizationDomain, AuthOrganizationRole, AdminCreateOrganizationInput, AuthOrganization, AdminCreateInvitationInput, AdminCreatePermissionInput, AdminPermission, AdminCreateUserInput, AdminUserSummary, AuthOrganizationInvitation, AdminOrganizationMember, AdminListParams, AdminListResult, AdminClient, AdminUpdateOrganizationInput, AdminUpdatePermissionInput, AdminUpdateUserInput } from '@datatechsolutions/shared-domain';
|
|
2
|
+
|
|
3
|
+
declare function setWindsockAdminClient(client: AdminClient, issuer: string, authFetch: typeof fetch): void;
|
|
4
|
+
declare function listUsers(params?: AdminListParams): Promise<AdminListResult<AdminUserSummary>>;
|
|
5
|
+
declare function createUser(data: AdminCreateUserInput): Promise<AdminUserSummary>;
|
|
6
|
+
declare function updateUser(userId: string, data: AdminUpdateUserInput): Promise<void>;
|
|
7
|
+
declare function deleteUser(userId: string): Promise<void>;
|
|
8
|
+
declare function resetUserPassword(userId: string, password: string): Promise<void>;
|
|
9
|
+
declare function listOrganizations(): Promise<AuthOrganization[]>;
|
|
10
|
+
declare function createOrganization(data: AdminCreateOrganizationInput): Promise<AuthOrganization>;
|
|
11
|
+
declare function updateOrganization(organizationId: string, data: AdminUpdateOrganizationInput): Promise<AuthOrganization>;
|
|
12
|
+
declare function deleteOrganization(organizationId: string): Promise<void>;
|
|
13
|
+
declare function listOrganizationMembers(organizationId: string): Promise<AdminOrganizationMember[]>;
|
|
14
|
+
declare function addOrganizationMember(organizationId: string, userId: string, role?: AuthOrganizationRole): Promise<void>;
|
|
15
|
+
declare function removeOrganizationMember(organizationId: string, userId: string): Promise<void>;
|
|
16
|
+
declare function listOrganizationInvitations(organizationId: string): Promise<AuthOrganizationInvitation[]>;
|
|
17
|
+
declare function createOrganizationInvitation(organizationId: string, data: AdminCreateInvitationInput): Promise<void>;
|
|
18
|
+
declare function listOrganizationDomains(organizationId: string): Promise<AuthOrganizationDomain[]>;
|
|
19
|
+
declare function addOrganizationDomain(organizationId: string, domain: string): Promise<AuthOrganizationDomain>;
|
|
20
|
+
declare function verifyOrganizationDomain(organizationId: string, domain: string): Promise<void>;
|
|
21
|
+
declare function listPermissions(): Promise<AdminPermission[]>;
|
|
22
|
+
declare function createPermission(data: AdminCreatePermissionInput): Promise<AdminPermission>;
|
|
23
|
+
declare function updatePermission(permissionId: string, data: AdminUpdatePermissionInput): Promise<void>;
|
|
24
|
+
declare function deletePermission(permissionId: string): Promise<void>;
|
|
25
|
+
declare function getUserPermissions(userId: string): Promise<AdminPermission[]>;
|
|
26
|
+
declare function setUserPermissions(userId: string, permissionIds: string[]): Promise<void>;
|
|
27
|
+
type SecretSummary = {
|
|
28
|
+
secretId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
secretType: string;
|
|
31
|
+
description: string | null;
|
|
32
|
+
expiresAt: string | null;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
};
|
|
37
|
+
type SecretDetail = SecretSummary & {
|
|
38
|
+
value?: string;
|
|
39
|
+
};
|
|
40
|
+
type CreateSecretInput = {
|
|
41
|
+
name: string;
|
|
42
|
+
value: string;
|
|
43
|
+
secretType?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
leaseTtlSeconds?: number;
|
|
46
|
+
};
|
|
47
|
+
type UpdateSecretInput = {
|
|
48
|
+
value: string;
|
|
49
|
+
leaseTtlSeconds?: number;
|
|
50
|
+
};
|
|
51
|
+
declare function listSecrets(organizationId: string): Promise<SecretSummary[]>;
|
|
52
|
+
declare function getSecret(organizationId: string, secretId: string): Promise<SecretDetail>;
|
|
53
|
+
declare function createSecret(organizationId: string, input: CreateSecretInput): Promise<SecretSummary>;
|
|
54
|
+
declare function rotateSecret(organizationId: string, secretId: string, input: UpdateSecretInput): Promise<SecretSummary>;
|
|
55
|
+
declare function disableSecret(organizationId: string, secretId: string): Promise<void>;
|
|
56
|
+
|
|
57
|
+
export { type CreateSecretInput, type SecretDetail, type SecretSummary, type UpdateSecretInput, addOrganizationDomain, addOrganizationMember, createOrganization, createOrganizationInvitation, createPermission, createSecret, createUser, deleteOrganization, deletePermission, deleteUser, disableSecret, getSecret, getUserPermissions, listOrganizationDomains, listOrganizationInvitations, listOrganizationMembers, listOrganizations, listPermissions, listSecrets, listUsers, removeOrganizationMember, resetUserPassword, rotateSecret, setUserPermissions, setWindsockAdminClient, updateOrganization, updatePermission, updateUser, verifyOrganizationDomain };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunk6PBTB5ZX_js = require('../chunk-6PBTB5ZX.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "addOrganizationDomain", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunk6PBTB5ZX_js.addOrganizationDomain; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "addOrganizationMember", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunk6PBTB5ZX_js.addOrganizationMember; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "createOrganization", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunk6PBTB5ZX_js.createOrganization; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "createOrganizationInvitation", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunk6PBTB5ZX_js.createOrganizationInvitation; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "createPermission", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunk6PBTB5ZX_js.createPermission; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "createSecret", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunk6PBTB5ZX_js.createSecret; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "createUser", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunk6PBTB5ZX_js.createUser; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "deleteOrganization", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunk6PBTB5ZX_js.deleteOrganization; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "deletePermission", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunk6PBTB5ZX_js.deletePermission; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "deleteUser", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunk6PBTB5ZX_js.deleteUser; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "disableSecret", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return chunk6PBTB5ZX_js.disableSecret; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "getSecret", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return chunk6PBTB5ZX_js.getSecret; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "getUserPermissions", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return chunk6PBTB5ZX_js.getUserPermissions; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "listOrganizationDomains", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return chunk6PBTB5ZX_js.listOrganizationDomains; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "listOrganizationInvitations", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return chunk6PBTB5ZX_js.listOrganizationInvitations; }
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "listOrganizationMembers", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return chunk6PBTB5ZX_js.listOrganizationMembers; }
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "listOrganizations", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return chunk6PBTB5ZX_js.listOrganizations; }
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "listPermissions", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return chunk6PBTB5ZX_js.listPermissions; }
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "listSecrets", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return chunk6PBTB5ZX_js.listSecrets; }
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "listUsers", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return chunk6PBTB5ZX_js.listUsers; }
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "removeOrganizationMember", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return chunk6PBTB5ZX_js.removeOrganizationMember; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "resetUserPassword", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return chunk6PBTB5ZX_js.resetUserPassword; }
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "rotateSecret", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return chunk6PBTB5ZX_js.rotateSecret; }
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "setUserPermissions", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return chunk6PBTB5ZX_js.setUserPermissions; }
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "setWindsockAdminClient", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () { return chunk6PBTB5ZX_js.setWindsockAdminClient; }
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "updateOrganization", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () { return chunk6PBTB5ZX_js.updateOrganization; }
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(exports, "updatePermission", {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function () { return chunk6PBTB5ZX_js.updatePermission; }
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "updateUser", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () { return chunk6PBTB5ZX_js.updateUser; }
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "verifyOrganizationDomain", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () { return chunk6PBTB5ZX_js.verifyOrganizationDomain; }
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=windsock-admin-client.js.map
|
|
125
|
+
//# sourceMappingURL=windsock-admin-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"windsock-admin-client.js"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { addOrganizationDomain, addOrganizationMember, createOrganization, createOrganizationInvitation, createPermission, createSecret, createUser, deleteOrganization, deletePermission, deleteUser, disableSecret, getSecret, getUserPermissions, listOrganizationDomains, listOrganizationInvitations, listOrganizationMembers, listOrganizations, listPermissions, listSecrets, listUsers, removeOrganizationMember, resetUserPassword, rotateSecret, setUserPermissions, setWindsockAdminClient, updateOrganization, updatePermission, updateUser, verifyOrganizationDomain } from '../chunk-UHHPBREK.mjs';
|
|
3
|
+
//# sourceMappingURL=windsock-admin-client.mjs.map
|
|
4
|
+
//# sourceMappingURL=windsock-admin-client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"windsock-admin-client.mjs"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Rule editing types.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the shape the Rust `RuleExecutor`
|
|
7
|
+
* (`lambda-rs/crates/astrlabe-handlers/src/engine/executors/rule.rs`) reads
|
|
8
|
+
* from `astrlabe.agent_rules.condition` + `action`. The UI builder below
|
|
9
|
+
* writes exactly this shape, so round-tripping through the backend is a
|
|
10
|
+
* no-op.
|
|
11
|
+
*/
|
|
12
|
+
type SimpleComparisonOperator = 'truthy' | 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains';
|
|
13
|
+
type RuleConditionOperator = SimpleComparisonOperator | 'regex_match' | 'threshold' | 'time_window' | 'boolean_expression';
|
|
14
|
+
type TimeWindow = {
|
|
15
|
+
startHour: number;
|
|
16
|
+
endHour: number;
|
|
17
|
+
startMinute?: number;
|
|
18
|
+
endMinute?: number;
|
|
19
|
+
/** 0 = Sunday, 6 = Saturday. Omit to match every day. */
|
|
20
|
+
daysOfWeek?: number[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Canonical rule-condition shape. The executor branches on `operator`,
|
|
24
|
+
* so every form tree ultimately serializes to this.
|
|
25
|
+
*/
|
|
26
|
+
type RuleCondition = {
|
|
27
|
+
operator: RuleConditionOperator;
|
|
28
|
+
/** Simple operators + regex_match + threshold + time_window */
|
|
29
|
+
field?: string;
|
|
30
|
+
/** Simple operators + threshold */
|
|
31
|
+
value?: string | number | boolean | null;
|
|
32
|
+
/** regex_match */
|
|
33
|
+
pattern?: string;
|
|
34
|
+
/** threshold — which direction `value` is compared in. */
|
|
35
|
+
comparison?: 'gt' | 'gte' | 'lt' | 'lte';
|
|
36
|
+
/** time_window */
|
|
37
|
+
timezone?: string;
|
|
38
|
+
windows?: TimeWindow[];
|
|
39
|
+
/** boolean_expression */
|
|
40
|
+
combinator?: 'and' | 'or';
|
|
41
|
+
operands?: RuleCondition[];
|
|
42
|
+
};
|
|
43
|
+
type RuleAction = {
|
|
44
|
+
type: string;
|
|
45
|
+
params?: Record<string, unknown>;
|
|
46
|
+
};
|
|
47
|
+
/** `agent_rules.status` free-form string — keep the UI picker aligned
|
|
48
|
+
* with the values the engine / audit trail recognizes today. */
|
|
49
|
+
declare const RULE_STATUS_OPTIONS: readonly ["draft", "active", "archived"];
|
|
50
|
+
type RuleStatus = (typeof RULE_STATUS_OPTIONS)[number];
|
|
51
|
+
declare const TIMEZONE_OPTIONS: readonly ["UTC", "America/Sao_Paulo", "America/New_York", "America/Los_Angeles", "Europe/London", "Europe/Lisbon"];
|
|
52
|
+
|
|
53
|
+
type RuleFormValue = {
|
|
54
|
+
ruleId?: string;
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
priority: number;
|
|
59
|
+
status?: RuleStatus;
|
|
60
|
+
validFrom?: string | null;
|
|
61
|
+
validUntil?: string | null;
|
|
62
|
+
tags?: string[];
|
|
63
|
+
condition: RuleCondition;
|
|
64
|
+
action: RuleAction;
|
|
65
|
+
};
|
|
66
|
+
type Props = {
|
|
67
|
+
value: RuleFormValue;
|
|
68
|
+
onChange: (next: RuleFormValue) => void;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Full-field rule editor used inside the create/edit modal. Composes the
|
|
72
|
+
* visual condition + action builders and exposes the schedule / tagging /
|
|
73
|
+
* lifecycle fields that the `agent_rules` entity has but the old JSON-
|
|
74
|
+
* textarea form never surfaced.
|
|
75
|
+
*/
|
|
76
|
+
declare function RuleForm({ value, onChange }: Props): react_jsx_runtime.JSX.Element;
|
|
77
|
+
declare function defaultRuleForm(): RuleFormValue;
|
|
78
|
+
|
|
79
|
+
export { type RuleFormValue as R, TIMEZONE_OPTIONS as T, type RuleCondition as a, type RuleAction as b, RULE_STATUS_OPTIONS as c, type RuleConditionOperator as d, RuleForm as e, type RuleStatus as f, type TimeWindow as g, defaultRuleForm as h };
|