@swell/cli 2.9.28 → 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,9 +216,13 @@ 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
  },
223
+ app: {
224
+ admin_url: runtime.app_admin_url,
225
+ },
222
226
  data: invocation.data,
223
227
  workflow: {
224
228
  workflow_id: runtime.workflow_id,
@@ -357,11 +361,16 @@ function getRuntimeApiHost(runtime) {
357
361
  return apiHost.replace(/\\/$/, '');
358
362
  }
359
363
 
364
+ // 'test' in the test environment, null in live
365
+ function runtimeEnvironmentId(runtime) {
366
+ return runtime.environment_id || null;
367
+ }
368
+
360
369
  function runtimeIdentity(runtime) {
361
370
  return {
362
371
  app_id: runtime.app_id,
363
372
  store_id: runtime.store_id,
364
- environment_id: runtime.environment_id || null,
373
+ environment_id: runtimeEnvironmentId(runtime),
365
374
  workflow_id: runtime.workflow_id,
366
375
  workflow_name: runtime.workflow_name,
367
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,
@@ -101,6 +101,9 @@ class SwellRequest {
101
101
  this.accessToken = req.headers.get('Swell-Access-Token');
102
102
  this.publicKey = req.headers.get('Swell-Public-Key');
103
103
  this.store = this.parseJson(req.headers.get('Swell-Store-Details'));
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;
104
107
  this.session = this.parseJson(req.headers.get('Swell-Session'));
105
108
  this.logParams = this.parseJson(req.headers.get('Swell-Request-Log'));
106
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.28"
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.28",
3
+ "version": "2.9.30",
4
4
  "type": "module",
5
5
  "description": "Swell's command line interface/utility",
6
6
  "keywords": [