@nordcraft/runtime 1.0.12 → 1.0.14

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/package.json CHANGED
@@ -4,8 +4,8 @@
4
4
  "type": "module",
5
5
  "homepage": "https://github.com/nordcraftengine/nordcraft",
6
6
  "dependencies": {
7
- "@nordcraft/core": "1.0.12",
8
- "@nordcraft/std-lib": "1.0.12",
7
+ "@nordcraft/core": "1.0.14",
8
+ "@nordcraft/std-lib": "1.0.14",
9
9
  "fast-deep-equal": "3.1.3",
10
10
  "path-to-regexp": "6.3.0"
11
11
  },
@@ -21,5 +21,5 @@
21
21
  "files": ["dist", "src"],
22
22
  "main": "dist/page.main.js",
23
23
  "types": "dist/page.main.d.ts",
24
- "version": "1.0.12"
24
+ "version": "1.0.14"
25
25
  }
@@ -47,7 +47,9 @@ export function createAPI(
47
47
  let timer: any = null
48
48
  let api = { ...apiRequest }
49
49
 
50
- function constructRequest(api: ApiRequest) {
50
+ function constructRequest(
51
+ api: ApiRequest,
52
+ ): ReturnType<typeof createApiRequest> {
51
53
  // Get baseUrl and validate it. (It wont be in web component context)
52
54
  let baseUrl: string | undefined = window.origin
53
55
  try {
@@ -56,12 +58,26 @@ export function createAPI(
56
58
  baseUrl = undefined
57
59
  }
58
60
 
59
- return createApiRequest({
61
+ const request = createApiRequest({
60
62
  api,
61
63
  formulaContext: getFormulaContext(api),
62
64
  baseUrl,
63
65
  defaultHeaders: undefined,
64
66
  })
67
+ return {
68
+ ...request,
69
+ requestSettings: {
70
+ ...request.requestSettings,
71
+ // credentials is a browser specific setting and cannot be set in the
72
+ // createApiRequest function directly as it's shared between server and client
73
+ credentials:
74
+ api.client?.credentials &&
75
+ ['include', 'same-origin', 'omit'].includes(api.client.credentials)
76
+ ? api.client.credentials
77
+ : // Default to same-origin
78
+ undefined,
79
+ },
80
+ }
65
81
  }
66
82
 
67
83
  // Create the formula context for the api