@milaboratories/pl-model-middle-layer 1.8.9 → 1.8.11

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.
@@ -113,16 +113,16 @@ export type HttpServerOptions = {
113
113
  host?: string;
114
114
  /** Port to bind to (defaults to 0 for auto-assignment) */
115
115
  port?: number;
116
- /** AbortSignal to stop the server */
117
- signal: AbortSignal;
118
116
  };
119
117
  /** Result of the server start operation */
120
- export type HttpServerStartResult = {
118
+ export interface HttpServer {
121
119
  /** Server address info */
122
- address: AddressInfo;
120
+ get address(): AddressInfo;
123
121
  /** Promise that resolves when the server is stopped */
124
- stopped: Promise<void>;
125
- };
122
+ get stopped(): Promise<void>;
123
+ /** Stop the server */
124
+ stop(): Promise<void>;
125
+ }
126
126
  export interface HttpHelpers {
127
127
  /**
128
128
  * Create an object store for serving files from a local directory.
@@ -147,7 +147,6 @@ export interface HttpHelpers {
147
147
  *
148
148
  * @example
149
149
  * ```ts
150
- * const abortController = new AbortController();
151
150
  * const rootDir = '/path/to/directory/with/parquet/files';
152
151
  * const port = 3000;
153
152
  *
@@ -155,20 +154,18 @@ export interface HttpHelpers {
155
154
  * throw new Error(`Failed to create file store for ${rootDir} - ${ensureError(err)}`);
156
155
  * });
157
156
  *
158
- * const { address: serverAddress, stopped: serverStopped } = await HttpHelpers.serve({
157
+ * const server = await HttpHelpers.createHttpServer({
159
158
  * handler: HttpHelpers.createRequestHandler(store),
160
159
  * port,
161
- * signal: abortController.signal
162
160
  * }).catch((err: unknown) => {
163
161
  * throw new Error(`Failed to start http server on port ${port} - ${ensureError(err)}`);
164
162
  * });
165
163
  *
166
- * const _ = HttpHelpers.createObjectStoreUrl(serverAddress);
164
+ * const _ = HttpHelpers.createObjectStoreUrl(server.address);
167
165
  *
168
- * abortController.abort();
169
- * await serverStopped;
166
+ * await server.stop();
170
167
  * ```
171
168
  */
172
- serve(options: HttpServerOptions): Promise<HttpServerStartResult>;
169
+ createHttpServer(options: HttpServerOptions): Promise<HttpServer>;
173
170
  }
174
171
  //# sourceMappingURL=http_helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http_helpers.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/http_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE/D,sBAAsB;AACtB,MAAM,MAAM,SAAS,GAAG;IACtB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,KAAK,CAAC,EAAE,IAAI,CAAC;CACd,CAAC;AAEF,+BAA+B;AAC/B,MAAM,MAAM,SAAS,GAAG;IACtB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,cAAc,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5C,KAAK,CAAC,EAAE,SAAS,CAAC;KACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB;AAED,+EAA+E;A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AAC;IAC7B,sBAAsB;IACtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAErD;;;;OAIG;IACH,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe,CAAC;IAE1D;;;OAGG;IACH,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc,CAAC;IAExD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-middle-layer",
3
- "version": "1.8.9",
3
+ "version": "1.8.11",
4
4
  "description": "Common model between middle layer and non-block UI code",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.cjs",
@@ -20,12 +20,12 @@
20
20
  "remeda": "^2.28.0",
21
21
  "zod": "~3.23.8",
22
22
  "utility-types": "^3.11.0",
23
- "@milaboratories/pl-model-common": "^1.19.10"
23
+ "@milaboratories/pl-model-common": "^1.19.12"
24
24
  },
25
25
  "devDependencies": {
26
26
  "typescript": "~5.6.3",
27
- "@milaboratories/ts-builder": "1.0.4",
28
27
  "@milaboratories/build-configs": "1.0.8",
28
+ "@milaboratories/ts-builder": "1.0.4",
29
29
  "@milaboratories/ts-configs": "1.0.6"
30
30
  },
31
31
  "scripts": {
@@ -120,17 +120,17 @@ export type HttpServerOptions = {
120
120
  host?: string;
121
121
  /** Port to bind to (defaults to 0 for auto-assignment) */
122
122
  port?: number;
123
- /** AbortSignal to stop the server */
124
- signal: AbortSignal;
125
123
  };
126
124
 
127
125
  /** Result of the server start operation */
128
- export type HttpServerStartResult = {
126
+ export interface HttpServer {
129
127
  /** Server address info */
130
- address: AddressInfo;
128
+ get address(): AddressInfo;
131
129
  /** Promise that resolves when the server is stopped */
132
- stopped: Promise<void>;
133
- };
130
+ get stopped(): Promise<void>;
131
+ /** Stop the server */
132
+ stop(): Promise<void>;
133
+ }
134
134
 
135
135
  export interface HttpHelpers {
136
136
  /**
@@ -159,7 +159,6 @@ export interface HttpHelpers {
159
159
  *
160
160
  * @example
161
161
  * ```ts
162
- * const abortController = new AbortController();
163
162
  * const rootDir = '/path/to/directory/with/parquet/files';
164
163
  * const port = 3000;
165
164
  *
@@ -167,19 +166,17 @@ export interface HttpHelpers {
167
166
  * throw new Error(`Failed to create file store for ${rootDir} - ${ensureError(err)}`);
168
167
  * });
169
168
  *
170
- * const { address: serverAddress, stopped: serverStopped } = await HttpHelpers.serve({
169
+ * const server = await HttpHelpers.createHttpServer({
171
170
  * handler: HttpHelpers.createRequestHandler(store),
172
171
  * port,
173
- * signal: abortController.signal
174
172
  * }).catch((err: unknown) => {
175
173
  * throw new Error(`Failed to start http server on port ${port} - ${ensureError(err)}`);
176
174
  * });
177
175
  *
178
- * const _ = HttpHelpers.createObjectStoreUrl(serverAddress);
176
+ * const _ = HttpHelpers.createObjectStoreUrl(server.address);
179
177
  *
180
- * abortController.abort();
181
- * await serverStopped;
178
+ * await server.stop();
182
179
  * ```
183
180
  */
184
- serve(options: HttpServerOptions): Promise<HttpServerStartResult>;
181
+ createHttpServer(options: HttpServerOptions): Promise<HttpServer>;
185
182
  }