@zapier/kitcore 0.17.2 → 0.18.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @zapier/kitcore
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2c8ea56: **Added `httpFetchPluginRef` (`kitcore/httpFetch`), the function
8
+ `dispatchHttpRequest` calls to reach the network.** Provide it and the default
9
+ dispatch stage calls that function instead of the ambient `fetch` — a
10
+ debug-wrapped fetch, a test double, a polyfill. Provide nothing and the stage
11
+ behaves as before.
12
+
13
+ ```ts
14
+ const httpFetch = defineProperty({
15
+ namespace: "kitcore",
16
+ name: "httpFetch",
17
+ value: myFetch,
18
+ });
19
+
20
+ // Or supply it by id, with no plugin of your own:
21
+ createSdk(root, { configuration: { [HTTP_FETCH_ID]: myFetch } });
22
+ ```
23
+
24
+ It is a value rather than a wrap, so the `dispatchHttpRequest` wrap slot stays
25
+ free for a host that replaces the stage outright.
26
+
3
27
  ## 0.17.2
4
28
 
5
29
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -29,6 +29,7 @@ __export(index_exports, {
29
29
  CoreError: () => CoreError,
30
30
  CoreErrorCode: () => CoreErrorCode,
31
31
  CoreSignal: () => CoreSignal,
32
+ HTTP_FETCH_ID: () => HTTP_FETCH_ID,
32
33
  RETRY_HTTP_REQUEST_OPTIONS_ID: () => RETRY_HTTP_REQUEST_OPTIONS_ID,
33
34
  STABILITY_LEVELS: () => STABILITY_LEVELS,
34
35
  STABILITY_TITLES: () => STABILITY_TITLES,
@@ -89,6 +90,7 @@ __export(index_exports, {
89
90
  getRegistry: () => getRegistry,
90
91
  getRegistryPlugin: () => getRegistryPlugin,
91
92
  getSchemaDescription: () => getSchemaDescription,
93
+ httpFetchPluginRef: () => httpFetchPluginRef,
92
94
  initializeHttpRequestPlugin: () => initializeHttpRequestPlugin,
93
95
  isCoreCancelledSignal: () => isCoreCancelledSignal,
94
96
  isCoreError: () => isCoreError,
@@ -4944,6 +4946,8 @@ var authorizeHttpRequestPlugin = defineMethod({
4944
4946
 
4945
4947
  // src/transport/dispatch-http-request.ts
4946
4948
  var import_zod7 = require("zod");
4949
+ var HTTP_FETCH_ID = "kitcore/httpFetch";
4950
+ var httpFetchPluginRef = declareOptionalProperty({ id: HTTP_FETCH_ID });
4947
4951
  function toFetchInput(request) {
4948
4952
  const init = { ...request };
4949
4953
  const { url } = request;
@@ -4954,11 +4958,12 @@ function toFetchInput(request) {
4954
4958
  var dispatchHttpRequestPlugin = defineMethod({
4955
4959
  name: "dispatchHttpRequest",
4956
4960
  namespace: "kitcore",
4961
+ imports: [httpFetchPluginRef],
4957
4962
  inputSchema: import_zod7.z.custom(),
4958
4963
  skipInputValidation: true,
4959
- run: async ({ input }) => {
4964
+ run: async ({ input, imports }) => {
4960
4965
  const { url, init } = toFetchInput(input.request);
4961
- return fetch(url, init);
4966
+ return (imports.httpFetch ?? fetch)(url, init);
4962
4967
  }
4963
4968
  });
4964
4969
 
@@ -5311,6 +5316,7 @@ var resolveConnectionPlugin = defineMethod({
5311
5316
  CoreError,
5312
5317
  CoreErrorCode,
5313
5318
  CoreSignal,
5319
+ HTTP_FETCH_ID,
5314
5320
  RETRY_HTTP_REQUEST_OPTIONS_ID,
5315
5321
  STABILITY_LEVELS,
5316
5322
  STABILITY_TITLES,
@@ -5371,6 +5377,7 @@ var resolveConnectionPlugin = defineMethod({
5371
5377
  getRegistry,
5372
5378
  getRegistryPlugin,
5373
5379
  getSchemaDescription,
5380
+ httpFetchPluginRef,
5374
5381
  initializeHttpRequestPlugin,
5375
5382
  isCoreCancelledSignal,
5376
5383
  isCoreError,