@lunnoa/client 1.5.0 → 2.1.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/dist/react.cjs CHANGED
@@ -58,7 +58,7 @@ function isBrowserEnvironment() {
58
58
  function assertApiKeyAllowedInEnvironment(apiKey) {
59
59
  if (isBrowserEnvironment()) {
60
60
  throw new Error(
61
- "Refusing to use a Lunnoa API key (lna_...) in a browser environment. API keys are server-side credentials: anyone opening dev tools could read the key and act as the service account across its whole workspace. Either call the Lunnoa API from your own backend which holds the key (backend-for-frontend pattern), or authenticate the end user with a Lunnoa user JWT and pass it as `accessToken`."
61
+ "Refusing to use a Lunnoa API key (lna_...) in a browser environment. API keys are for the CLI and operator scripts, not for app login. Anyone opening dev tools could read the key and act as the service account across its whole workspace. Sign the end user in with lunnoa.auth.login and pass their JWT as `accessToken`."
62
62
  );
63
63
  }
64
64
  if (!apiKey.startsWith(API_KEY_PREFIX)) {
@@ -140,7 +140,7 @@ var HttpClient = class {
140
140
  }
141
141
  if (!options.apiKey && !options.accessToken && !options.tokenStore) {
142
142
  throw new Error(
143
- "LunnoaClient requires an apiKey (server-side), an accessToken (user JWT), or a tokenStore (Pattern B)."
143
+ "LunnoaClient requires an accessToken or tokenStore (Lunnoa user JWT), or an apiKey for operator scripts."
144
144
  );
145
145
  }
146
146
  if (options.apiKey) {
@@ -702,12 +702,12 @@ var AgentsResource = class {
702
702
  });
703
703
  }
704
704
  /**
705
- * Upsert an agent by project-scoped slug.
705
+ * Upsert an agent by slug inside the workspace on the API key.
706
706
  * Prefer the CLI (`npx @lunnoa/client agents deploy`) for happy-path deploy.
707
707
  */
708
- upsertBySlug(projectId, body, options) {
708
+ upsertBySlug(body, options) {
709
709
  const payload = "kind" in body && body.kind === "agent" ? agentDefinitionToUpsert(body, options) : body;
710
- return this.http.post(`/api/projects/${projectId}/agents/upsert`, {
710
+ return this.http.post("/api/agents/upsert", {
711
711
  body: payload
712
712
  });
713
713
  }
@@ -1131,10 +1131,8 @@ var TablesResource = class {
1131
1131
  }
1132
1132
  http;
1133
1133
  /** Lists tables in the API key's workspace (without columns and rows). */
1134
- list(options = {}) {
1135
- return this.http.get("/api/tables", {
1136
- query: { projectId: options.projectId }
1137
- });
1134
+ list() {
1135
+ return this.http.get("/api/tables");
1138
1136
  }
1139
1137
  /** Returns a single table by ID, including columns and rows. */
1140
1138
  get(id) {
@@ -1554,30 +1552,6 @@ var KnowledgeResource = class {
1554
1552
  }
1555
1553
  };
1556
1554
 
1557
- // src/resources/projects.ts
1558
- var ProjectsResource = class {
1559
- constructor(http) {
1560
- this.http = http;
1561
- }
1562
- http;
1563
- /** Lists projects in the workspace, most recently updated first. */
1564
- list(options) {
1565
- return this.http.get("/api/projects", {
1566
- query: serializeListQuery(options)
1567
- });
1568
- }
1569
- /** Returns a single project. */
1570
- get(projectId, options) {
1571
- return this.http.get(`/api/projects/${projectId}`, {
1572
- query: serializeListQuery(options)
1573
- });
1574
- }
1575
- /** Creates a project. */
1576
- create(data) {
1577
- return this.http.post("/api/projects", { body: data });
1578
- }
1579
- };
1580
-
1581
1555
  // src/resources/queue-items.ts
1582
1556
  var QueueItemsResource = class {
1583
1557
  constructor(http) {
@@ -1857,7 +1831,7 @@ var RunsResource = class {
1857
1831
  * Start a linear multi-step ad-hoc Execution.
1858
1832
  *
1859
1833
  * Accepts a `defineWorkflow` result, a step array, or an explicit
1860
- * `{ steps, projectId?, name? }` payload.
1834
+ * `{ steps, name? }` payload.
1861
1835
  */
1862
1836
  start(input) {
1863
1837
  const options = normalizeStartRunInput(input);
@@ -2075,15 +2049,14 @@ var WorkflowsResource = class {
2075
2049
  });
2076
2050
  }
2077
2051
  /**
2078
- * Upsert a workflow by project-scoped slug from a linear step list.
2052
+ * Upsert a workflow by slug inside the workspace on the API key.
2079
2053
  * Prefer the CLI (`npx @lunnoa/client workflows deploy`) for happy-path deploy.
2080
2054
  */
2081
- upsertBySlug(projectId, body) {
2055
+ upsertBySlug(body) {
2082
2056
  const payload = "kind" in body && body.kind === "workflow" ? workflowDefinitionToUpsert(body) : body;
2083
- return this.http.post(
2084
- `/api/projects/${projectId}/workflows/upsert`,
2085
- { body: payload }
2086
- );
2057
+ return this.http.post("/api/workflows/upsert", {
2058
+ body: payload
2059
+ });
2087
2060
  }
2088
2061
  /**
2089
2062
  * Starts a new execution of the workflow with the given trigger inputs.
@@ -2118,7 +2091,7 @@ var WorkflowsResource = class {
2118
2091
  var LunnoaClient = class {
2119
2092
  /** The underlying HTTP layer, exposed for advanced/escape-hatch requests. */
2120
2093
  http;
2121
- /** Login, refresh, SSO discovery, and session helpers (Pattern B). */
2094
+ /** Login, refresh, SSO discovery, and session helpers for Lunnoa users. */
2122
2095
  auth;
2123
2096
  agents;
2124
2097
  tasks;
@@ -2145,7 +2118,6 @@ var LunnoaClient = class {
2145
2118
  variables;
2146
2119
  scorecards;
2147
2120
  connections;
2148
- projects;
2149
2121
  workflowApps;
2150
2122
  discovery;
2151
2123
  constructor(options) {
@@ -2169,7 +2141,6 @@ var LunnoaClient = class {
2169
2141
  this.variables = new VariablesResource(this.http);
2170
2142
  this.scorecards = new ScorecardsResource(this.http);
2171
2143
  this.connections = new ConnectionsResource(this.http);
2172
- this.projects = new ProjectsResource(this.http);
2173
2144
  this.discovery = new DiscoveryResource(this.http);
2174
2145
  }
2175
2146
  };