@lunnoa/client 1.4.0 → 2.0.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/README.md +17 -10
- package/dist/cli.js +219 -107
- package/dist/index.cjs +40 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1327 -1333
- package/dist/index.d.ts +1327 -1333
- package/dist/index.js +40 -37
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +59 -37
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +665 -718
- package/dist/react.d.ts +665 -718
- package/dist/react.js +59 -37
- package/dist/react.js.map +1 -1
- package/package.json +2 -6
- package/skills/lunnoa-client/SKILL.md +23 -11
- package/skills/lunnoa-solution-design/SKILL.md +21 -5
package/dist/react.cjs
CHANGED
|
@@ -7,6 +7,24 @@ var ai = require('ai');
|
|
|
7
7
|
// src/react/auth.tsx
|
|
8
8
|
|
|
9
9
|
// src/auth/token-store.ts
|
|
10
|
+
function createMemoryTokenStore(initial) {
|
|
11
|
+
let accessToken = null;
|
|
12
|
+
let refreshToken = null;
|
|
13
|
+
return {
|
|
14
|
+
getAccessToken: () => accessToken,
|
|
15
|
+
getRefreshToken: () => refreshToken,
|
|
16
|
+
setTokens: (tokens) => {
|
|
17
|
+
accessToken = tokens.accessToken;
|
|
18
|
+
if (tokens.refreshToken !== void 0) {
|
|
19
|
+
refreshToken = tokens.refreshToken;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
clear: () => {
|
|
23
|
+
accessToken = null;
|
|
24
|
+
refreshToken = null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
10
28
|
function createLocalStorageTokenStore(options = {}) {
|
|
11
29
|
const accessTokenKey = options.accessTokenKey ?? "accessToken";
|
|
12
30
|
const refreshTokenKey = options.refreshTokenKey ?? "refreshToken";
|
|
@@ -684,12 +702,12 @@ var AgentsResource = class {
|
|
|
684
702
|
});
|
|
685
703
|
}
|
|
686
704
|
/**
|
|
687
|
-
* Upsert an agent by
|
|
705
|
+
* Upsert an agent by slug inside the workspace on the API key.
|
|
688
706
|
* Prefer the CLI (`npx @lunnoa/client agents deploy`) for happy-path deploy.
|
|
689
707
|
*/
|
|
690
|
-
upsertBySlug(
|
|
708
|
+
upsertBySlug(body, options) {
|
|
691
709
|
const payload = "kind" in body && body.kind === "agent" ? agentDefinitionToUpsert(body, options) : body;
|
|
692
|
-
return this.http.post(
|
|
710
|
+
return this.http.post("/api/agents/upsert", {
|
|
693
711
|
body: payload
|
|
694
712
|
});
|
|
695
713
|
}
|
|
@@ -1106,6 +1124,33 @@ var EntityTypesResource = class {
|
|
|
1106
1124
|
}
|
|
1107
1125
|
};
|
|
1108
1126
|
|
|
1127
|
+
// src/resources/tables.ts
|
|
1128
|
+
var TablesResource = class {
|
|
1129
|
+
constructor(http) {
|
|
1130
|
+
this.http = http;
|
|
1131
|
+
}
|
|
1132
|
+
http;
|
|
1133
|
+
/** Lists tables in the API key's workspace (without columns and rows). */
|
|
1134
|
+
list() {
|
|
1135
|
+
return this.http.get("/api/tables");
|
|
1136
|
+
}
|
|
1137
|
+
/** Returns a single table by ID, including columns and rows. */
|
|
1138
|
+
get(id) {
|
|
1139
|
+
return this.http.get(`/api/tables/${id}`);
|
|
1140
|
+
}
|
|
1141
|
+
/** Returns a single table by its workspace slug, including columns and rows. */
|
|
1142
|
+
getBySlug(slug) {
|
|
1143
|
+
return this.http.get(`/api/tables/slug/${slug}`);
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Creates or updates a table by workspace slug. Omitted columns or rows
|
|
1147
|
+
* keep their current value. Marks `managedByCode` by default.
|
|
1148
|
+
*/
|
|
1149
|
+
upsertBySlug(input) {
|
|
1150
|
+
return this.http.post("/api/tables/upsert", { body: input });
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1109
1154
|
// src/resources/approvals.ts
|
|
1110
1155
|
var ApprovalsResource = class {
|
|
1111
1156
|
constructor(http) {
|
|
@@ -1507,30 +1552,6 @@ var KnowledgeResource = class {
|
|
|
1507
1552
|
}
|
|
1508
1553
|
};
|
|
1509
1554
|
|
|
1510
|
-
// src/resources/projects.ts
|
|
1511
|
-
var ProjectsResource = class {
|
|
1512
|
-
constructor(http) {
|
|
1513
|
-
this.http = http;
|
|
1514
|
-
}
|
|
1515
|
-
http;
|
|
1516
|
-
/** Lists projects in the workspace, most recently updated first. */
|
|
1517
|
-
list(options) {
|
|
1518
|
-
return this.http.get("/api/projects", {
|
|
1519
|
-
query: serializeListQuery(options)
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
/** Returns a single project. */
|
|
1523
|
-
get(projectId, options) {
|
|
1524
|
-
return this.http.get(`/api/projects/${projectId}`, {
|
|
1525
|
-
query: serializeListQuery(options)
|
|
1526
|
-
});
|
|
1527
|
-
}
|
|
1528
|
-
/** Creates a project. */
|
|
1529
|
-
create(data) {
|
|
1530
|
-
return this.http.post("/api/projects", { body: data });
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
1555
|
// src/resources/queue-items.ts
|
|
1535
1556
|
var QueueItemsResource = class {
|
|
1536
1557
|
constructor(http) {
|
|
@@ -1810,7 +1831,7 @@ var RunsResource = class {
|
|
|
1810
1831
|
* Start a linear multi-step ad-hoc Execution.
|
|
1811
1832
|
*
|
|
1812
1833
|
* Accepts a `defineWorkflow` result, a step array, or an explicit
|
|
1813
|
-
* `{ steps,
|
|
1834
|
+
* `{ steps, name? }` payload.
|
|
1814
1835
|
*/
|
|
1815
1836
|
start(input) {
|
|
1816
1837
|
const options = normalizeStartRunInput(input);
|
|
@@ -2028,15 +2049,14 @@ var WorkflowsResource = class {
|
|
|
2028
2049
|
});
|
|
2029
2050
|
}
|
|
2030
2051
|
/**
|
|
2031
|
-
* Upsert a workflow by
|
|
2052
|
+
* Upsert a workflow by slug inside the workspace on the API key.
|
|
2032
2053
|
* Prefer the CLI (`npx @lunnoa/client workflows deploy`) for happy-path deploy.
|
|
2033
2054
|
*/
|
|
2034
|
-
upsertBySlug(
|
|
2055
|
+
upsertBySlug(body) {
|
|
2035
2056
|
const payload = "kind" in body && body.kind === "workflow" ? workflowDefinitionToUpsert(body) : body;
|
|
2036
|
-
return this.http.post(
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
);
|
|
2057
|
+
return this.http.post("/api/workflows/upsert", {
|
|
2058
|
+
body: payload
|
|
2059
|
+
});
|
|
2040
2060
|
}
|
|
2041
2061
|
/**
|
|
2042
2062
|
* Starts a new execution of the workflow with the given trigger inputs.
|
|
@@ -2090,13 +2110,14 @@ var LunnoaClient = class {
|
|
|
2090
2110
|
approvals;
|
|
2091
2111
|
entities;
|
|
2092
2112
|
entityTypes;
|
|
2113
|
+
/** Small reference / lookup tables (rows stored inline; use entities for transactional data). */
|
|
2114
|
+
tables;
|
|
2093
2115
|
knowledge;
|
|
2094
2116
|
queues;
|
|
2095
2117
|
queueItems;
|
|
2096
2118
|
variables;
|
|
2097
2119
|
scorecards;
|
|
2098
2120
|
connections;
|
|
2099
|
-
projects;
|
|
2100
2121
|
workflowApps;
|
|
2101
2122
|
discovery;
|
|
2102
2123
|
constructor(options) {
|
|
@@ -2113,13 +2134,13 @@ var LunnoaClient = class {
|
|
|
2113
2134
|
this.workflows = new WorkflowsResource(this.http, this.executions);
|
|
2114
2135
|
this.entities = new EntitiesResource(this.http);
|
|
2115
2136
|
this.entityTypes = new EntityTypesResource(this.http);
|
|
2137
|
+
this.tables = new TablesResource(this.http);
|
|
2116
2138
|
this.knowledge = new KnowledgeResource(this.http);
|
|
2117
2139
|
this.queues = new QueuesResource(this.http);
|
|
2118
2140
|
this.queueItems = new QueueItemsResource(this.http);
|
|
2119
2141
|
this.variables = new VariablesResource(this.http);
|
|
2120
2142
|
this.scorecards = new ScorecardsResource(this.http);
|
|
2121
2143
|
this.connections = new ConnectionsResource(this.http);
|
|
2122
|
-
this.projects = new ProjectsResource(this.http);
|
|
2123
2144
|
this.discovery = new DiscoveryResource(this.http);
|
|
2124
2145
|
}
|
|
2125
2146
|
};
|
|
@@ -2150,7 +2171,8 @@ function resolveClient(props) {
|
|
|
2150
2171
|
}
|
|
2151
2172
|
return createBrowserClient({
|
|
2152
2173
|
baseUrl: options.baseUrl,
|
|
2153
|
-
|
|
2174
|
+
// SSR (e.g. Next.js) has no localStorage; the browser builds its own client on hydration.
|
|
2175
|
+
tokenStore: options.tokenStore ?? (typeof window === "undefined" ? createMemoryTokenStore() : void 0),
|
|
2154
2176
|
autoRefresh: options.autoRefresh,
|
|
2155
2177
|
fetch: options.fetch,
|
|
2156
2178
|
headers: options.headers
|