@swell/cli 2.9.29 → 2.9.30

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.
@@ -216,6 +216,7 @@ function buildWorkflowRequest(invocation, proxy) {
216
216
  return {
217
217
  id: runtime.request_id,
218
218
  appId: runtime.app_slug || runtime.app_id,
219
+ environmentId: runtimeEnvironmentId(runtime),
219
220
  store: {
220
221
  id: runtime.store_id,
221
222
  },
@@ -360,11 +361,16 @@ function getRuntimeApiHost(runtime) {
360
361
  return apiHost.replace(/\\/$/, '');
361
362
  }
362
363
 
364
+ // 'test' in the test environment, null in live
365
+ function runtimeEnvironmentId(runtime) {
366
+ return runtime.environment_id || null;
367
+ }
368
+
363
369
  function runtimeIdentity(runtime) {
364
370
  return {
365
371
  app_id: runtime.app_id,
366
372
  store_id: runtime.store_id,
367
- environment_id: runtime.environment_id || null,
373
+ environment_id: runtimeEnvironmentId(runtime),
368
374
  workflow_id: runtime.workflow_id,
369
375
  workflow_name: runtime.workflow_name,
370
376
  workflow_instance_id: runtime.workflow_instance_id,
@@ -10,6 +10,8 @@ export interface MockRequestOptions {
10
10
  swell?: Partial<SwellAPI>;
11
11
  store?: Partial<SwellStore>;
12
12
  appId?: string;
13
+ // 'test' in the test environment, null in live
14
+ environmentId?: string | null;
13
15
  }
14
16
 
15
17
  function createDefaultSwellMock(): Partial<SwellAPI> {
@@ -38,6 +40,7 @@ export function createMockRequest(options: MockRequestOptions = {}): SwellReques
38
40
  swell,
39
41
  store,
40
42
  appId,
43
+ environmentId = null,
41
44
  } = options;
42
45
 
43
46
  const requestHeaders = new Headers(headers);
@@ -71,7 +74,11 @@ export function createMockRequest(options: MockRequestOptions = {}): SwellReques
71
74
 
72
75
  const resolvedAppId = appId || "${options.appId}";
73
76
 
74
- const req: Partial<SwellRequest> & { appId: string; storeId: string } = {
77
+ const req: Partial<SwellRequest> & {
78
+ appId: string;
79
+ storeId: string;
80
+ environmentId: string | null;
81
+ } = {
75
82
  originalRequest,
76
83
  context,
77
84
  url: new URL(url),
@@ -81,6 +88,7 @@ export function createMockRequest(options: MockRequestOptions = {}): SwellReques
81
88
  credentials: "include",
82
89
  appId: resolvedAppId,
83
90
  storeId,
91
+ environmentId,
84
92
  accessToken: null,
85
93
  publicKey: null,
86
94
  store: resolvedStore,
@@ -102,6 +102,8 @@ class SwellRequest {
102
102
  this.publicKey = req.headers.get('Swell-Public-Key');
103
103
  this.store = this.parseJson(req.headers.get('Swell-Store-Details'));
104
104
  this.app = this.parseJson(req.headers.get('Swell-App-Details'));
105
+ // 'test' in the test environment, null in live
106
+ this.environmentId = req.headers.get('Swell-Env') || null;
105
107
  this.session = this.parseJson(req.headers.get('Swell-Session'));
106
108
  this.logParams = this.parseJson(req.headers.get('Swell-Request-Log'));
107
109
  this.apiHost = req.headers.get('Swell-API-Host') || 'https://api.schema.io';
@@ -3685,5 +3685,5 @@
3685
3685
  ]
3686
3686
  }
3687
3687
  },
3688
- "version": "2.9.29"
3688
+ "version": "2.9.30"
3689
3689
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swell/cli",
3
- "version": "2.9.29",
3
+ "version": "2.9.30",
4
4
  "type": "module",
5
5
  "description": "Swell's command line interface/utility",
6
6
  "keywords": [