cloudcruise 1.3.1 → 1.4.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.
@@ -6,6 +6,7 @@ import { RunsClient } from './runs/RunsClient.js';
6
6
  import { WebhookClient } from './webhook/WebhookClient.js';
7
7
  import { ConnectionManager } from './utils/connectionManager.js';
8
8
  import { inputValidationErrorFromResponse } from './workflows/validation.js';
9
+ import { clientIdentityHeaders } from './clientIdentity.js';
9
10
  const DEFAULT_BASE_URL = 'https://api.cloudcruise.com';
10
11
  const STAGING_BASE_URL = 'https://staging-api.cloudcruise.app';
11
12
  const ALLOWED_BASE_URLS = new Set([DEFAULT_BASE_URL, STAGING_BASE_URL]);
@@ -76,6 +77,7 @@ export class CloudCruise {
76
77
  async makeRequest(method, path, body) {
77
78
  const url = `${this.baseUrl}${path}`;
78
79
  const headers = {
80
+ ...clientIdentityHeaders(),
79
81
  'Content-Type': 'application/json',
80
82
  'cc-key': this.apiKey
81
83
  };
@@ -0,0 +1 @@
1
+ export declare function clientIdentityHeaders(): Record<string, string>;
@@ -0,0 +1,9 @@
1
+ import { detectAgent } from 'std-env';
2
+ import { SDK_VERSION } from './version.js';
3
+ export function clientIdentityHeaders() {
4
+ const agent = detectAgent().name;
5
+ return {
6
+ 'X-CloudCruise-Client': `sdk-js/${SDK_VERSION}`,
7
+ ...(agent ? { 'X-CloudCruise-Agent': agent } : {})
8
+ };
9
+ }
@@ -2,6 +2,7 @@ import { openSSE } from './sse.js';
2
2
  import { SimpleEventEmitter } from './events.js';
3
3
  import { AsyncEventQueue } from './asyncQueue.js';
4
4
  import { EventType } from '../events/types.js';
5
+ import { clientIdentityHeaders } from '../clientIdentity.js';
5
6
  function isFinalEvent(eventType) {
6
7
  return (eventType === EventType.ExecutionSuccess ||
7
8
  eventType === EventType.ExecutionFailed ||
@@ -121,6 +122,7 @@ export class ConnectionManager {
121
122
  await this.ensureClientId();
122
123
  this.connecting = true;
123
124
  const headers = {
125
+ ...clientIdentityHeaders(),
124
126
  'cc-key': this.apiKey
125
127
  };
126
128
  const url = `${this.baseUrl}/run/clients/${this.clientId}/events`;
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "1.4.0";
@@ -0,0 +1 @@
1
+ export const SDK_VERSION = '1.4.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcruise",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "The official CloudCruise JS/TS client.",
5
5
  "homepage": "https://github.com/CloudCruise/cloudcruise-js#readme",
6
6
  "bugs": {
@@ -19,8 +19,8 @@
19
19
  "dist"
20
20
  ],
21
21
  "scripts": {
22
- "build": "tsc",
23
- "dev": "tsc --watch",
22
+ "build": "node scripts/sync-version.mjs && tsc",
23
+ "dev": "node scripts/sync-version.mjs && tsc --watch",
24
24
  "prepublishOnly": "npm run build",
25
25
  "test": "pnpm build && node --test test/*.test.js"
26
26
  },
@@ -32,6 +32,12 @@
32
32
  "node": ">=18.0.0"
33
33
  },
34
34
  "dependencies": {
35
- "ajv": "^8.20.0"
35
+ "ajv": "^8.20.0",
36
+ "std-env": "^4.3.0"
37
+ },
38
+ "pnpm": {
39
+ "overrides": {
40
+ "fast-uri": "3.1.8"
41
+ }
36
42
  }
37
43
  }