@pikku/fetch 0.12.1 → 0.12.2

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,3 +1,10 @@
1
+ ## 0.12.2
2
+
3
+ ### Patch Changes
4
+
5
+ - 9060165: New realtime events system: `pikku realtime` generates a typed `PikkuRealtime` client that pairs with `PikkuRPC`. A `/events` channel can be scaffolded to fan out server events to subscribers over SSE. `pikku dev` wires `LocalEventHubService` automatically so realtime works out of the box locally. The React provider exposes `PikkuRealtime` alongside `PikkuRPC`.
6
+ - 9060165: Fix `@pikku/addon-graph` package exports so generated bootstrap files can be imported correctly. The Node.js HTTP server adapter is unified across dev, standalone, and container deployments. Next.js gains a worker-RPC transport. Date values in fetch responses now deserialise correctly.
7
+
1
8
  ## 0.12.0
2
9
 
3
10
  ## 0.12.1
@@ -45,6 +45,11 @@ export declare class CorePikkuFetch {
45
45
  * @param {string} serverUrl - The server URL to be set.
46
46
  */
47
47
  setServerUrl(serverUrl: string): void;
48
+ /**
49
+ * Returns the configured base server URL (without trailing slash), or
50
+ * undefined if it hasn't been set yet.
51
+ */
52
+ getServerUrl(): string | undefined;
48
53
  /**
49
54
  * Sets the JWT for authorization.
50
55
  *
@@ -57,6 +57,13 @@ class CorePikkuFetch {
57
57
  }
58
58
  this.options.serverUrl = serverUrl;
59
59
  }
60
+ /**
61
+ * Returns the configured base server URL (without trailing slash), or
62
+ * undefined if it hasn't been set yet.
63
+ */
64
+ getServerUrl() {
65
+ return this.options.serverUrl;
66
+ }
60
67
  /**
61
68
  * Sets the JWT for authorization.
62
69
  *
@@ -198,7 +205,7 @@ class CorePikkuFetch {
198
205
  * @returns {any} - The transformed data.
199
206
  */
200
207
  transformDates(data) {
201
- if (!this.options.transformDate) {
208
+ if (this.options.transformDate === false) {
202
209
  return data;
203
210
  }
204
211
  return (0, transform_date_js_1.transformDates)(data);
@@ -6,5 +6,6 @@
6
6
  *
7
7
  * @module @pikku/fetch
8
8
  */
9
- export { CorePikkuFetch, CorePikkuFetchOptions, HTTPMethod, } from './core-pikku-fetch.js';
9
+ export { CorePikkuFetch } from './core-pikku-fetch.js';
10
+ export type { CorePikkuFetchOptions, HTTPMethod } from './core-pikku-fetch.js';
10
11
  export { corePikkuFetch } from './pikku-fetch.js';
@@ -45,6 +45,11 @@ export declare class CorePikkuFetch {
45
45
  * @param {string} serverUrl - The server URL to be set.
46
46
  */
47
47
  setServerUrl(serverUrl: string): void;
48
+ /**
49
+ * Returns the configured base server URL (without trailing slash), or
50
+ * undefined if it hasn't been set yet.
51
+ */
52
+ getServerUrl(): string | undefined;
48
53
  /**
49
54
  * Sets the JWT for authorization.
50
55
  *
@@ -46,6 +46,13 @@ export class CorePikkuFetch {
46
46
  }
47
47
  this.options.serverUrl = serverUrl;
48
48
  }
49
+ /**
50
+ * Returns the configured base server URL (without trailing slash), or
51
+ * undefined if it hasn't been set yet.
52
+ */
53
+ getServerUrl() {
54
+ return this.options.serverUrl;
55
+ }
49
56
  /**
50
57
  * Sets the JWT for authorization.
51
58
  *
@@ -180,7 +187,7 @@ export class CorePikkuFetch {
180
187
  * @returns {any} - The transformed data.
181
188
  */
182
189
  transformDates(data) {
183
- if (!this.options.transformDate) {
190
+ if (this.options.transformDate === false) {
184
191
  return data;
185
192
  }
186
193
  return transformDates(data);
@@ -6,5 +6,6 @@
6
6
  *
7
7
  * @module @pikku/fetch
8
8
  */
9
- export { CorePikkuFetch, CorePikkuFetchOptions, HTTPMethod, } from './core-pikku-fetch.js';
9
+ export { CorePikkuFetch } from './core-pikku-fetch.js';
10
+ export type { CorePikkuFetchOptions, HTTPMethod } from './core-pikku-fetch.js';
10
11
  export { corePikkuFetch } from './pikku-fetch.js';
package/dist/esm/index.js CHANGED
@@ -6,5 +6,5 @@
6
6
  *
7
7
  * @module @pikku/fetch
8
8
  */
9
- export { CorePikkuFetch, } from './core-pikku-fetch.js';
9
+ export { CorePikkuFetch } from './core-pikku-fetch.js';
10
10
  export { corePikkuFetch } from './pikku-fetch.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/fetch",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -72,6 +72,14 @@ export class CorePikkuFetch {
72
72
  this.options.serverUrl = serverUrl
73
73
  }
74
74
 
75
+ /**
76
+ * Returns the configured base server URL (without trailing slash), or
77
+ * undefined if it hasn't been set yet.
78
+ */
79
+ public getServerUrl(): string | undefined {
80
+ return this.options.serverUrl
81
+ }
82
+
75
83
  /**
76
84
  * Sets the JWT for authorization.
77
85
  *
@@ -234,7 +242,7 @@ export class CorePikkuFetch {
234
242
  * @returns {any} - The transformed data.
235
243
  */
236
244
  private transformDates(data: any): any {
237
- if (!this.options.transformDate) {
245
+ if (this.options.transformDate === false) {
238
246
  return data
239
247
  }
240
248
  return transformDates(data)
@@ -0,0 +1,11 @@
1
+ import assert from 'node:assert/strict'
2
+ import { describe, test } from 'node:test'
3
+
4
+ import { CorePikkuFetch, corePikkuFetch } from './index.js'
5
+
6
+ describe('@pikku/fetch', () => {
7
+ test('exports the public fetch client API', () => {
8
+ assert.equal(typeof CorePikkuFetch, 'function')
9
+ assert.equal(typeof corePikkuFetch, 'function')
10
+ })
11
+ })
package/src/index.ts CHANGED
@@ -7,9 +7,6 @@
7
7
  * @module @pikku/fetch
8
8
  */
9
9
 
10
- export {
11
- CorePikkuFetch,
12
- CorePikkuFetchOptions,
13
- HTTPMethod,
14
- } from './core-pikku-fetch.js'
10
+ export { CorePikkuFetch } from './core-pikku-fetch.js'
11
+ export type { CorePikkuFetchOptions, HTTPMethod } from './core-pikku-fetch.js'
15
12
  export { corePikkuFetch } from './pikku-fetch.js'