@feasibleone/blong 1.14.0 → 1.15.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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.15.0](https://github.com/feasibleone/blong/compare/blong-v1.14.0...blong-v1.15.0) (2026-04-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * implement ConfigRuntime for hot configuration reload ([#115](https://github.com/feasibleone/blong/issues/115)) ([61bab7c](https://github.com/feasibleone/blong/commit/61bab7ce8587bf83d72fe80138aaef68943f21c4))
9
+ * unified test and handlers ([#117](https://github.com/feasibleone/blong/issues/117)) ([bf0ed96](https://github.com/feasibleone/blong/commit/bf0ed96c5df3d949fa225dd8a30fc25698a7855a))
10
+
3
11
  ## [1.14.0](https://github.com/feasibleone/blong/compare/blong-v1.13.0...blong-v1.14.0) (2026-03-29)
4
12
 
5
13
 
package/dist/types.d.ts CHANGED
@@ -17640,6 +17640,7 @@ export interface IRpcServer {
17640
17640
  unregister: (methods: string[], namespace: string, reply: boolean) => void;
17641
17641
  start: () => Promise<IRpcServer>;
17642
17642
  stop: () => Promise<IRpcServer>;
17643
+ setAttachCheckpoint?: (fn: ((meta: IMeta) => void) | undefined) => void;
17643
17644
  }
17644
17645
  export interface ILocal {
17645
17646
  register: (methods: object, namespace: string, reply: boolean, pkg: {
@@ -17683,6 +17684,7 @@ export interface IRegistry {
17683
17684
  methods: Map<string, Handlers>;
17684
17685
  modules: Map<string | symbol, IRegistry[]>;
17685
17686
  createPort: (id: string) => Promise<ReturnType<IAdapterFactory>>;
17687
+ getPort: (id: string) => ReturnType<IAdapterFactory> | undefined;
17686
17688
  replaceHandlers: (id: string, handlers: object) => Promise<void>;
17687
17689
  loadApi: (id: string, def: {
17688
17690
  namespace: Record<string, string | string[]>;
@@ -17725,6 +17727,7 @@ export interface IApi {
17725
17727
  utLog: {
17726
17728
  createLog: ILog["logger"];
17727
17729
  };
17730
+ attachCheckpoint?: (meta: IMeta) => void;
17728
17731
  handlers?: (api: {
17729
17732
  utError: IError;
17730
17733
  remote: IRemote;
@@ -17801,6 +17804,21 @@ export interface IAdapter<T, C> {
17801
17804
  waiting: unknown;
17802
17805
  buffer: unknown;
17803
17806
  }) => void;
17807
+ /**
17808
+ * Optional lifecycle hook called when configuration changes.
17809
+ * When present, the framework calls this instead of a full stop+start cycle.
17810
+ * The adapter should inspect `diff` and only recreate the resources that
17811
+ * actually changed (e.g. destroy and rebuild the DB connection pool when
17812
+ * the `knex` sub-key is in the diff, but leave everything else intact).
17813
+ *
17814
+ * @param diff Flat map of dotted config paths to `{prev, next}` pairs
17815
+ * @param next The full new effective config snapshot (via proxy)
17816
+ * @param prev The full previous effective config snapshot
17817
+ */
17818
+ configChanged?: (diff: Map<string, {
17819
+ prev: unknown;
17820
+ next: unknown;
17821
+ }>, next: object, prev: object) => Promise<void>;
17804
17822
  }
17805
17823
  export interface IAdapterFactory<T = Record<string, unknown>, C = Record<string, unknown>> {
17806
17824
  config?: Config<T, C> | false;
@@ -17878,6 +17896,13 @@ export interface IMeta {
17878
17896
  };
17879
17897
  gateway?: object;
17880
17898
  validation?: unknown;
17899
+ name?: string;
17900
+ checkpoint?: CheckpointFn;
17901
+ checkpoints?: Array<{
17902
+ name: string;
17903
+ data?: unknown;
17904
+ timestamp: number;
17905
+ }>;
17881
17906
  }
17882
17907
  export type HRTime = [
17883
17908
  number,
@@ -18001,18 +18026,22 @@ export type ThenableProxy = Promise<unknown> & {
18001
18026
  export type ChainStep = ((assert: typeof Assert, context: {
18002
18027
  $meta: IMeta;
18003
18028
  } & Record<string, Promise<unknown[]> & ThenableProxy>) => Promise<object>) | object;
18029
+ export type CheckpointFn = (this: IMeta, name: string, data?: unknown) => void;
18004
18030
  export interface ILib {
18005
18031
  type: typeof Type;
18006
18032
  error: <T>(errors: T) => Record<keyof T, (params?: unknown, $meta?: IMeta) => ITypedError>;
18007
18033
  rename: <T extends object>(object: T, name: string) => T & {
18008
18034
  name: string;
18009
18035
  };
18036
+ /** @deprecated The framework now auto-names step arrays from handler names. */
18010
18037
  group: (name: string) => (handlers: ChainStep[]) => ChainStep[] & {
18011
18038
  name: string;
18012
18039
  };
18040
+ assert: typeof Assert | undefined;
18013
18041
  ulid: () => string;
18014
18042
  uuid4: () => string;
18015
18043
  uuid7: () => string;
18044
+ setProperty: (obj: Record<string, unknown>, path: string, value: unknown) => void;
18016
18045
  merge<T, S1>(target: T, source: S1): T & S1;
18017
18046
  merge<T, S1, S2>(target: T, source1: S1, source2: S2): T & S1 & S2;
18018
18047
  merge<T, S1, S2, S3>(target: T, source1: S1, source2: S2, source3: S3): T & S1 & S2 & S3;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,IAAI,GAWP,MAAM,SAAS,CAAC;AAMjB,OAAO,KAAK,MAAM,mBAAmB,CAAC;AAulBtC,MAAM,IAAI,GAAW,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAG9C,MAAM,OAAgB,QAAQ;IAC1B,IAAI,CAAQ;IACF,GAAG,CAA8B;IAC3C,YAAmB,GAAiB;QAChC,IAAI,CAAC,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC;IACzB,CAAC;IACS,KAAK,GAAkB,CAAC,GAAG,IAA+B,EAAE,EAAE;QACpE,MAAM,MAAM,GAAG,KAAK,CAAqB,GAAG,IAAI,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI;YAC5B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAC,CAAC,CAAC;QAChF,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IACK,KAAK,CAAC,I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AC;AACjE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAoB,UAA8B,EAAsB,EAAE,CAC5F,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,EAAC,KAAK,EAAE,QAAQ,EAAC,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAoB,UAA8B,EAAsB,EAAE,CAC7F,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,KAAK,GAAG,CACjB,UAA4C,EACZ,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC;AACjG,MAAM,CAAC,MAAM,OAAO,GAAG,CACnB,UAAiC,EACZ,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC;AACxF,MAAM,CAAC,MAAM,YAAY,GAAG,CACxB,UAAiC,EACZ,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC,CAAC,CAAC;AAW7F,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAiC,EAAqB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEzF,eAAe;IACX,OAAO;IACP,OAAO;IACP,UAAU;IACV,GAAG;IACH,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,YAAY;IACZ,IAAI;CACP,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feasibleone/blong",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "API and DRY focused RAD framework https://feasibleone.github.io/blong-docs",
5
5
  "keywords": [
6
6
  "blong",
package/types.ts CHANGED
@@ -128,6 +128,7 @@ export interface IRpcServer {
128
128
  unregister: (methods: string[], namespace: string, reply: boolean) => void;
129
129
  start: () => Promise<IRpcServer>;
130
130
  stop: () => Promise<IRpcServer>;
131
+ setAttachCheckpoint?: (fn: ((meta: IMeta) => void) | undefined) => void;
131
132
  }
132
133
 
133
134
  export interface ILocal {
@@ -172,6 +173,7 @@ export interface IRegistry {
172
173
  methods: Map<string, Handlers>;
173
174
  modules: Map<string | symbol, IRegistry[]>;
174
175
  createPort: (id: string) => Promise<ReturnType<IAdapterFactory>>;
176
+ getPort: (id: string) => ReturnType<IAdapterFactory> | undefined;
175
177
  replaceHandlers: (id: string, handlers: object) => Promise<void>;
176
178
  loadApi: (
177
179
  id: string,
@@ -220,6 +222,7 @@ export interface IApi {
220
222
  utLog: {
221
223
  createLog: ILog['logger'];
222
224
  };
225
+ attachCheckpoint?: (meta: IMeta) => void;
223
226
  handlers?: (api: {utError: IError; remote: IRemote; type: typeof Type}) => {
224
227
  extends?:
225
228
  | string
@@ -303,6 +306,22 @@ export interface IAdapter<T, C> {
303
306
  what: unknown,
304
307
  context: {requests: unknown; waiting: unknown; buffer: unknown},
305
308
  ) => void;
309
+ /**
310
+ * Optional lifecycle hook called when configuration changes.
311
+ * When present, the framework calls this instead of a full stop+start cycle.
312
+ * The adapter should inspect `diff` and only recreate the resources that
313
+ * actually changed (e.g. destroy and rebuild the DB connection pool when
314
+ * the `knex` sub-key is in the diff, but leave everything else intact).
315
+ *
316
+ * @param diff Flat map of dotted config paths to `{prev, next}` pairs
317
+ * @param next The full new effective config snapshot (via proxy)
318
+ * @param prev The full previous effective config snapshot
319
+ */
320
+ configChanged?: (
321
+ diff: Map<string, {prev: unknown; next: unknown}>,
322
+ next: object,
323
+ prev: object,
324
+ ) => Promise<void>;
306
325
  }
307
326
 
308
327
  export interface IAdapterFactory<T = Record<string, unknown>, C = Record<string, unknown>> {
@@ -382,6 +401,9 @@ export interface IMeta {
382
401
  };
383
402
  gateway?: object;
384
403
  validation?: unknown;
404
+ name?: string;
405
+ checkpoint?: CheckpointFn;
406
+ checkpoints?: Array<{name: string; data?: unknown; timestamp: number}>;
385
407
  }
386
408
 
387
409
  export type HRTime = [number, number];
@@ -520,14 +542,19 @@ export type ChainStep =
520
542
  ) => Promise<object>)
521
543
  | object;
522
544
 
545
+ export type CheckpointFn = (this: IMeta, name: string, data?: unknown) => void;
546
+
523
547
  export interface ILib {
524
548
  type: typeof Type;
525
549
  error: <T>(errors: T) => Record<keyof T, (params?: unknown, $meta?: IMeta) => ITypedError>;
526
550
  rename: <T extends object>(object: T, name: string) => T & {name: string};
551
+ /** @deprecated The framework now auto-names step arrays from handler names. */
527
552
  group: (name: string) => (handlers: ChainStep[]) => ChainStep[] & {name: string};
553
+ assert: typeof Assert | undefined;
528
554
  ulid: () => string;
529
555
  uuid4: () => string;
530
556
  uuid7: () => string;
557
+ setProperty: (obj: Record<string, unknown>, path: string, value: unknown) => void;
531
558
  merge<T, S1>(target: T, source: S1): T & S1;
532
559
  merge<T, S1, S2>(target: T, source1: S1, source2: S2): T & S1 & S2;
533
560
  merge<T, S1, S2, S3>(target: T, source1: S1, source2: S2, source3: S3): T & S1 & S2 & S3;