@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.js CHANGED
@@ -56,7 +56,7 @@ function isBrowserEnvironment() {
56
56
  function assertApiKeyAllowedInEnvironment(apiKey) {
57
57
  if (isBrowserEnvironment()) {
58
58
  throw new Error(
59
- "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`."
59
+ "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`."
60
60
  );
61
61
  }
62
62
  if (!apiKey.startsWith(API_KEY_PREFIX)) {
@@ -138,7 +138,7 @@ var HttpClient = class {
138
138
  }
139
139
  if (!options.apiKey && !options.accessToken && !options.tokenStore) {
140
140
  throw new Error(
141
- "LunnoaClient requires an apiKey (server-side), an accessToken (user JWT), or a tokenStore (Pattern B)."
141
+ "LunnoaClient requires an accessToken or tokenStore (Lunnoa user JWT), or an apiKey for operator scripts."
142
142
  );
143
143
  }
144
144
  if (options.apiKey) {
@@ -700,12 +700,12 @@ var AgentsResource = class {
700
700
  });
701
701
  }
702
702
  /**
703
- * Upsert an agent by project-scoped slug.
703
+ * Upsert an agent by slug inside the workspace on the API key.
704
704
  * Prefer the CLI (`npx @lunnoa/client agents deploy`) for happy-path deploy.
705
705
  */
706
- upsertBySlug(projectId, body, options) {
706
+ upsertBySlug(body, options) {
707
707
  const payload = "kind" in body && body.kind === "agent" ? agentDefinitionToUpsert(body, options) : body;
708
- return this.http.post(`/api/projects/${projectId}/agents/upsert`, {
708
+ return this.http.post("/api/agents/upsert", {
709
709
  body: payload
710
710
  });
711
711
  }
@@ -1129,10 +1129,8 @@ var TablesResource = class {
1129
1129
  }
1130
1130
  http;
1131
1131
  /** Lists tables in the API key's workspace (without columns and rows). */
1132
- list(options = {}) {
1133
- return this.http.get("/api/tables", {
1134
- query: { projectId: options.projectId }
1135
- });
1132
+ list() {
1133
+ return this.http.get("/api/tables");
1136
1134
  }
1137
1135
  /** Returns a single table by ID, including columns and rows. */
1138
1136
  get(id) {
@@ -1552,30 +1550,6 @@ var KnowledgeResource = class {
1552
1550
  }
1553
1551
  };
1554
1552
 
1555
- // src/resources/projects.ts
1556
- var ProjectsResource = class {
1557
- constructor(http) {
1558
- this.http = http;
1559
- }
1560
- http;
1561
- /** Lists projects in the workspace, most recently updated first. */
1562
- list(options) {
1563
- return this.http.get("/api/projects", {
1564
- query: serializeListQuery(options)
1565
- });
1566
- }
1567
- /** Returns a single project. */
1568
- get(projectId, options) {
1569
- return this.http.get(`/api/projects/${projectId}`, {
1570
- query: serializeListQuery(options)
1571
- });
1572
- }
1573
- /** Creates a project. */
1574
- create(data) {
1575
- return this.http.post("/api/projects", { body: data });
1576
- }
1577
- };
1578
-
1579
1553
  // src/resources/queue-items.ts
1580
1554
  var QueueItemsResource = class {
1581
1555
  constructor(http) {
@@ -1855,7 +1829,7 @@ var RunsResource = class {
1855
1829
  * Start a linear multi-step ad-hoc Execution.
1856
1830
  *
1857
1831
  * Accepts a `defineWorkflow` result, a step array, or an explicit
1858
- * `{ steps, projectId?, name? }` payload.
1832
+ * `{ steps, name? }` payload.
1859
1833
  */
1860
1834
  start(input) {
1861
1835
  const options = normalizeStartRunInput(input);
@@ -2073,15 +2047,14 @@ var WorkflowsResource = class {
2073
2047
  });
2074
2048
  }
2075
2049
  /**
2076
- * Upsert a workflow by project-scoped slug from a linear step list.
2050
+ * Upsert a workflow by slug inside the workspace on the API key.
2077
2051
  * Prefer the CLI (`npx @lunnoa/client workflows deploy`) for happy-path deploy.
2078
2052
  */
2079
- upsertBySlug(projectId, body) {
2053
+ upsertBySlug(body) {
2080
2054
  const payload = "kind" in body && body.kind === "workflow" ? workflowDefinitionToUpsert(body) : body;
2081
- return this.http.post(
2082
- `/api/projects/${projectId}/workflows/upsert`,
2083
- { body: payload }
2084
- );
2055
+ return this.http.post("/api/workflows/upsert", {
2056
+ body: payload
2057
+ });
2085
2058
  }
2086
2059
  /**
2087
2060
  * Starts a new execution of the workflow with the given trigger inputs.
@@ -2116,7 +2089,7 @@ var WorkflowsResource = class {
2116
2089
  var LunnoaClient = class {
2117
2090
  /** The underlying HTTP layer, exposed for advanced/escape-hatch requests. */
2118
2091
  http;
2119
- /** Login, refresh, SSO discovery, and session helpers (Pattern B). */
2092
+ /** Login, refresh, SSO discovery, and session helpers for Lunnoa users. */
2120
2093
  auth;
2121
2094
  agents;
2122
2095
  tasks;
@@ -2143,7 +2116,6 @@ var LunnoaClient = class {
2143
2116
  variables;
2144
2117
  scorecards;
2145
2118
  connections;
2146
- projects;
2147
2119
  workflowApps;
2148
2120
  discovery;
2149
2121
  constructor(options) {
@@ -2167,7 +2139,6 @@ var LunnoaClient = class {
2167
2139
  this.variables = new VariablesResource(this.http);
2168
2140
  this.scorecards = new ScorecardsResource(this.http);
2169
2141
  this.connections = new ConnectionsResource(this.http);
2170
- this.projects = new ProjectsResource(this.http);
2171
2142
  this.discovery = new DiscoveryResource(this.http);
2172
2143
  }
2173
2144
  };