@scarn/sdk 0.8.20 → 0.8.21

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.
Files changed (65) hide show
  1. package/dist/auth/api-token-cache.d.ts +24 -0
  2. package/dist/auth/api-token-source.d.ts +39 -0
  3. package/dist/auth/authenticated-fetch.d.ts +10 -0
  4. package/dist/auth/index.d.ts +3 -0
  5. package/dist/auth/index.js +20 -0
  6. package/dist/automations/index.js +4 -4
  7. package/dist/{chunk-pqtd0hr7.js → chunk-08gcnrzh.js} +2 -2
  8. package/dist/{chunk-g4j5cfpc.js → chunk-0he2dx5n.js} +5 -5
  9. package/dist/{chunk-z4smq8qd.js → chunk-59arcerk.js} +1 -1
  10. package/dist/{chunk-46wmsgv7.js → chunk-5say64w8.js} +1 -1
  11. package/dist/{chunk-habmdf89.js → chunk-6p340dd4.js} +1 -1
  12. package/dist/{chunk-19brnwkp.js → chunk-8hsk6f6b.js} +1 -1
  13. package/dist/{chunk-098740f7.js → chunk-8kzaxz52.js} +1 -1
  14. package/dist/{chunk-n3ywwx7n.js → chunk-8tmsvkmj.js} +5 -5
  15. package/dist/{chunk-e0pt5x0e.js → chunk-aph2js2v.js} +5 -5
  16. package/dist/chunk-azss2d1n.js +1036 -0
  17. package/dist/{chunk-t1dq2c2s.js → chunk-gasw078g.js} +5 -5
  18. package/dist/{chunk-0c60x3v8.js → chunk-h1v6w1fh.js} +5 -5
  19. package/dist/{chunk-tr3v83cn.js → chunk-k57h6qke.js} +8 -5
  20. package/dist/{chunk-aemxz9r7.js → chunk-mrzn5tq4.js} +1 -1
  21. package/dist/{chunk-qgkx89eg.js → chunk-nkm31g10.js} +3 -3
  22. package/dist/{chunk-yq0sf8sb.js → chunk-p74r4y6j.js} +13 -13
  23. package/dist/{chunk-a56zc4s5.js → chunk-pwyj6qf3.js} +2 -2
  24. package/dist/{chunk-b9ja6ss5.js → chunk-qt81x1pm.js} +1 -1
  25. package/dist/{chunk-mzj1j0p5.js → chunk-r3sbp2wn.js} +3 -3
  26. package/dist/{chunk-rphfy0fj.js → chunk-vsp708vw.js} +1 -1
  27. package/dist/{chunk-yf15kdte.js → chunk-xhpp6qz8.js} +96 -96
  28. package/dist/{chunk-y34zsgsw.js → chunk-y7ac1t9c.js} +1 -1
  29. package/dist/{chunk-rq5k7m33.js → chunk-y81cr6tp.js} +28 -14
  30. package/dist/{chunk-91f5gm5z.js → chunk-zxzvketc.js} +5 -5
  31. package/dist/client.d.ts +5 -1
  32. package/dist/client.js +2 -2
  33. package/dist/connectors/index.js +4 -4
  34. package/dist/contracts/artifacts.js +2 -2
  35. package/dist/contracts/automation-document/index.js +3 -3
  36. package/dist/contracts/pipeline-document/index.js +2 -2
  37. package/dist/contracts/step-artifact-submissions.js +2 -2
  38. package/dist/contracts/work-item-changes.js +1 -1
  39. package/dist/create-api-client.d.ts +11 -0
  40. package/dist/defaults/index.js +32 -871
  41. package/dist/defaults/load-push-defaults.d.ts +11 -4
  42. package/dist/defaults/project-ref.d.ts +2 -4
  43. package/dist/definitions/automations/automations-client.d.ts +2 -1
  44. package/dist/definitions/automations/index.js +3 -3
  45. package/dist/definitions/environments/environments-client.d.ts +2 -1
  46. package/dist/definitions/environments/index.js +10 -10
  47. package/dist/definitions/pipelines/index.js +3 -3
  48. package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +2 -1
  49. package/dist/definitions/steps/index.js +13 -13
  50. package/dist/definitions/steps/step-definitions-client.d.ts +2 -1
  51. package/dist/definitions/validation/index.js +10 -10
  52. package/dist/devcontainer-config-path.js +2 -2
  53. package/dist/env-vars.js +2 -2
  54. package/dist/environment.js +7 -7
  55. package/dist/health-checks.js +2 -2
  56. package/dist/index.js +20 -20
  57. package/dist/managed-runtimes.js +2 -2
  58. package/dist/opencode-mcp.js +3 -3
  59. package/dist/pipelines/index.js +3 -3
  60. package/dist/push/index.js +42 -41
  61. package/dist/push/push-from-directory.d.ts +6 -1
  62. package/dist/repo-config.js +2 -2
  63. package/dist/resolve-environment.js +8 -8
  64. package/dist/task-plane-client.d.ts +6 -0
  65. package/package.json +6 -2
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  exports_external
4
- } from "./chunk-yf15kdte.js";
4
+ } from "./chunk-xhpp6qz8.js";
5
5
 
6
6
  // src/health-checks.ts
7
7
  var healthCheckSeverityValues = ["required", "warn"];
@@ -1,4 +1,16 @@
1
1
  // @bun
2
+ // src/generated/core/bodySerializer.gen.ts
3
+ var jsonBodySerializer = {
4
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
5
+ };
6
+ // src/generated/core/params.gen.ts
7
+ var extraPrefixesMap = {
8
+ $body_: "body",
9
+ $headers_: "headers",
10
+ $path_: "path",
11
+ $query_: "query"
12
+ };
13
+ var extraPrefixes = Object.entries(extraPrefixesMap);
2
14
  // src/generated/core/serverSentEvents.gen.ts
3
15
  var createSseClient = ({
4
16
  onRequest,
@@ -363,11 +375,6 @@ var getAuthToken = async (auth, callback) => {
363
375
  return token;
364
376
  };
365
377
 
366
- // src/generated/core/bodySerializer.gen.ts
367
- var jsonBodySerializer = {
368
- bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
369
- };
370
-
371
378
  // src/generated/client/utils.gen.ts
372
379
  var createQuerySerializer = ({
373
380
  parameters = {},
@@ -791,14 +798,6 @@ var createClient = (config = {}) => {
791
798
  trace: makeMethodFn("TRACE")
792
799
  };
793
800
  };
794
- // src/generated/core/params.gen.ts
795
- var extraPrefixesMap = {
796
- $body_: "body",
797
- $headers_: "headers",
798
- $path_: "path",
799
- $query_: "query"
800
- };
801
- var extraPrefixes = Object.entries(extraPrefixesMap);
802
801
  // src/generated/client.gen.ts
803
802
  var client = createClient(createConfig());
804
803
 
@@ -1957,4 +1956,19 @@ class ScarnClient extends HeyApiClient {
1957
1956
  }
1958
1957
  }
1959
1958
 
1960
- export { createClient, Api, Projects, StepDefinitions, Tasks, TaskRuns, PipelineDefinitions, Automations, PipelineExecutions, WorkItems, Conversations, WorkItemComments, WorkItemCommentDrafts, WorkItemBlocks, ProjectArtifacts, UserNotifications, Inbox, NotificationRules, ProjectIntegrations, GitHubIntegrations, ProjectInvites, Billing, Username, Secrets, ProjectSecrets, Environments, Connectors, ScarnClient };
1959
+ // src/create-api-client.ts
1960
+ function createApiClient(baseUrl, options) {
1961
+ const client2 = createClient({
1962
+ baseUrl,
1963
+ headers: options?.headers,
1964
+ fetch: options?.fetch
1965
+ });
1966
+ client2.interceptors.error.use((error, response) => {
1967
+ if (response === undefined)
1968
+ throw error;
1969
+ return error;
1970
+ });
1971
+ return client2;
1972
+ }
1973
+
1974
+ export { Api, Projects, StepDefinitions, Tasks, TaskRuns, PipelineDefinitions, Automations, PipelineExecutions, WorkItems, Conversations, WorkItemComments, WorkItemCommentDrafts, WorkItemBlocks, ProjectArtifacts, UserNotifications, Inbox, NotificationRules, ProjectIntegrations, GitHubIntegrations, ProjectInvites, Billing, Username, Secrets, ProjectSecrets, Environments, Connectors, ScarnClient, createApiClient };
@@ -1,11 +1,11 @@
1
1
  // @bun
2
2
  import {
3
3
  PipelineDefinitions,
4
- createClient
5
- } from "./chunk-rq5k7m33.js";
4
+ createApiClient
5
+ } from "./chunk-y81cr6tp.js";
6
6
  import {
7
7
  exports_external
8
- } from "./chunk-yf15kdte.js";
8
+ } from "./chunk-xhpp6qz8.js";
9
9
 
10
10
  // src/definitions/pipelines/pipeline-definitions-client.ts
11
11
  var pipelineDocumentIssueSchema = exports_external.object({
@@ -40,8 +40,8 @@ function unwrap(result) {
40
40
  }
41
41
  return result.data;
42
42
  }
43
- function createPipelineDefinitionsClient(baseUrl) {
44
- const client = createClient({ baseUrl });
43
+ function createPipelineDefinitionsClient(baseUrl, options) {
44
+ const client = createApiClient(baseUrl, { fetch: options?.fetch });
45
45
  return buildPipelineDefinitionsClient(new PipelineDefinitions({ client }));
46
46
  }
47
47
  var buildPipelineDefinitionsClient = (pipelineDefinitions) => ({
package/dist/client.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { ScarnClient } from "./generated";
2
2
  export * from "./task-plane-client";
3
3
  export * from "./generated/";
4
- export declare function createScarnClient(baseUrl: string): ScarnClient;
4
+ export type ScarnClientOptions = {
5
+ /** Replaces `fetch` for every request, e.g. one from `createAuthenticatedFetch`. */
6
+ fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined;
7
+ };
8
+ export declare function createScarnClient(baseUrl: string, options?: ScarnClientOptions): ScarnClient;
package/dist/client.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  createScarnClient,
4
4
  createTaskPlaneClient
5
- } from "./chunk-tr3v83cn.js";
5
+ } from "./chunk-k57h6qke.js";
6
6
  import {
7
7
  Api,
8
8
  Automations,
@@ -31,7 +31,7 @@ import {
31
31
  WorkItemCommentDrafts,
32
32
  WorkItemComments,
33
33
  WorkItems
34
- } from "./chunk-rq5k7m33.js";
34
+ } from "./chunk-y81cr6tp.js";
35
35
  import"./chunk-y64skrwp.js";
36
36
  export {
37
37
  Api,
@@ -16,10 +16,10 @@ import {
16
16
  listConnectorSummaries,
17
17
  mergeConnectorMcpServers,
18
18
  validateConnectorCatalog
19
- } from "../chunk-qgkx89eg.js";
20
- import"../chunk-pqtd0hr7.js";
21
- import"../chunk-aemxz9r7.js";
22
- import"../chunk-yf15kdte.js";
19
+ } from "../chunk-nkm31g10.js";
20
+ import"../chunk-08gcnrzh.js";
21
+ import"../chunk-mrzn5tq4.js";
22
+ import"../chunk-xhpp6qz8.js";
23
23
  import"../chunk-y64skrwp.js";
24
24
  export {
25
25
  CONNECTOR_CATALOG,
@@ -10,8 +10,8 @@ import {
10
10
  isEmbeddableArtifactExtension,
11
11
  matchArtifactNode,
12
12
  readArtifactKeyword
13
- } from "../chunk-19brnwkp.js";
14
- import"../chunk-yf15kdte.js";
13
+ } from "../chunk-8hsk6f6b.js";
14
+ import"../chunk-xhpp6qz8.js";
15
15
  import"../chunk-y64skrwp.js";
16
16
  export {
17
17
  ARTIFACT_SCHEMA_KEYWORD,
@@ -13,9 +13,9 @@ import {
13
13
  automationTargetSchema,
14
14
  eventHasChild,
15
15
  scopeOfEvent
16
- } from "../../chunk-a56zc4s5.js";
17
- import"../../chunk-b9ja6ss5.js";
18
- import"../../chunk-yf15kdte.js";
16
+ } from "../../chunk-pwyj6qf3.js";
17
+ import"../../chunk-qt81x1pm.js";
18
+ import"../../chunk-xhpp6qz8.js";
19
19
  import"../../chunk-y64skrwp.js";
20
20
  export {
21
21
  AUTOMATION_EVENTS,
@@ -41,7 +41,7 @@ import {
41
41
  succeedNodeSchema,
42
42
  toleratedFailuresSchema,
43
43
  waitNodeSchema
44
- } from "../../chunk-b9ja6ss5.js";
44
+ } from "../../chunk-qt81x1pm.js";
45
45
  import {
46
46
  BUILT_IN_ERRORS,
47
47
  CONVERSATION_RESULT_SCHEMA,
@@ -51,7 +51,7 @@ import {
51
51
  WAIT_ERRORS,
52
52
  decisionResultSchema
53
53
  } from "../../chunk-01nfqm18.js";
54
- import"../../chunk-yf15kdte.js";
54
+ import"../../chunk-xhpp6qz8.js";
55
55
  import"../../chunk-y64skrwp.js";
56
56
  export {
57
57
  ALIAS_PATTERN,
@@ -3,10 +3,10 @@ import {
3
3
  artifactAcceptsFile,
4
4
  artifactFileExtension,
5
5
  findArtifactFields
6
- } from "../chunk-19brnwkp.js";
6
+ } from "../chunk-8hsk6f6b.js";
7
7
  import {
8
8
  exports_external
9
- } from "../chunk-yf15kdte.js";
9
+ } from "../chunk-xhpp6qz8.js";
10
10
  import"../chunk-y64skrwp.js";
11
11
 
12
12
  // src/contracts/step-artifact-submissions.ts
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  exports_external
4
- } from "../chunk-yf15kdte.js";
4
+ } from "../chunk-xhpp6qz8.js";
5
5
  import"../chunk-y64skrwp.js";
6
6
 
7
7
  // src/contracts/work-item-changes.ts
@@ -0,0 +1,11 @@
1
+ import { createClient } from "./generated/client";
2
+ /**
3
+ * The generated `createClient`, configured so that an error thrown by `fetch`
4
+ * itself (a failed token mint, a network error) fails the call as is instead of
5
+ * being folded into `{ error: {} }`. Errors carried by a response are left to
6
+ * the caller as usual.
7
+ */
8
+ export declare function createApiClient(baseUrl: string, options?: {
9
+ headers?: Record<string, string> | undefined;
10
+ fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined;
11
+ }): ReturnType<typeof createClient>;