@bgord/bun 1.15.1 → 1.15.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/dist/command-envelope.d.ts +6 -4
- package/dist/command-envelope.d.ts.map +1 -1
- package/dist/command-envelope.js +4 -0
- package/dist/command-envelope.js.map +1 -1
- package/dist/event-envelope.d.ts +1 -0
- package/dist/event-envelope.d.ts.map +1 -1
- package/dist/event-envelope.js +7 -0
- package/dist/event-envelope.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/command-envelope.ts +9 -0
- package/src/event-envelope.ts +13 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import type { ClockPort } from "./clock.port";
|
|
2
3
|
import type { IdProviderPort } from "./id-provider.port";
|
|
3
4
|
type Dependencies = {
|
|
@@ -5,14 +6,15 @@ type Dependencies = {
|
|
|
5
6
|
Clock: ClockPort;
|
|
6
7
|
};
|
|
7
8
|
export declare const CommandEnvelopeSchema: {
|
|
8
|
-
id:
|
|
9
|
-
correlationId:
|
|
10
|
-
createdAt:
|
|
9
|
+
id: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
10
|
+
correlationId: v.SchemaWithPipe<readonly [v.StringSchema<"uuid.type">, v.UuidAction<string, "uuid.type">]>;
|
|
11
|
+
createdAt: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "TimestampValue">]>;
|
|
11
12
|
};
|
|
12
13
|
export declare const createCommandEnvelope: (deps: Dependencies) => {
|
|
13
14
|
readonly id: string;
|
|
14
15
|
readonly correlationId: string;
|
|
15
|
-
readonly createdAt: number &
|
|
16
|
+
readonly createdAt: number & v.Brand<"TimestampValue">;
|
|
16
17
|
};
|
|
18
|
+
export declare function command<Schema extends v.ObjectSchema<any, any>>(schema: Schema, fields: Omit<v.InferOutput<Schema>, "id" | "correlationId" | "createdAt" | "name">, deps: Dependencies): v.InferOutput<Schema>;
|
|
17
19
|
export {};
|
|
18
20
|
//# sourceMappingURL=command-envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-envelope.d.ts","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,YAAY,GAAG;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,qBAAqB;;;;CAAqE,CAAC;AAExG,eAAO,MAAM,qBAAqB,GAAI,MAAM,YAAY;;;;CAK3C,CAAC"}
|
|
1
|
+
{"version":3,"file":"command-envelope.d.ts","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,YAAY,GAAG;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,qBAAqB;;;;CAAqE,CAAC;AAExG,eAAO,MAAM,qBAAqB,GAAI,MAAM,YAAY;;;;CAK3C,CAAC;AAEd,wBAAgB,OAAO,CAAC,MAAM,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7D,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,eAAe,GAAG,WAAW,GAAG,MAAM,CAAC,EAClF,IAAI,EAAE,YAAY,GACjB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAEvB"}
|
package/dist/command-envelope.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
|
+
import * as v from "valibot";
|
|
2
3
|
import { CorrelationStorage } from "./correlation-storage.service";
|
|
3
4
|
import { UUID } from "./uuid.vo";
|
|
4
5
|
export const CommandEnvelopeSchema = { id: UUID, correlationId: UUID, createdAt: tools.TimestampValue };
|
|
@@ -7,4 +8,7 @@ export const createCommandEnvelope = (deps) => ({
|
|
|
7
8
|
correlationId: CorrelationStorage.get(),
|
|
8
9
|
createdAt: deps.Clock.now().ms,
|
|
9
10
|
});
|
|
11
|
+
export function command(schema, fields, deps) {
|
|
12
|
+
return v.parse(schema, { ...createCommandEnvelope(deps), name: schema.entries.name.literal, ...fields });
|
|
13
|
+
}
|
|
10
14
|
//# sourceMappingURL=command-envelope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-envelope.js","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"command-envelope.js","sourceRoot":"","sources":["../src/command-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC;AAExG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAkB,EAAE,EAAE,CAC1D,CAAC;IACC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC9B,aAAa,EAAE,kBAAkB,CAAC,GAAG,EAAE;IACvC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE;CAC/B,CAAU,CAAC;AAEd,MAAM,UAAU,OAAO,CACrB,MAAc,EACd,MAAkF,EAClF,IAAkB;IAElB,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAC3G,CAAC"}
|
package/dist/event-envelope.d.ts
CHANGED
|
@@ -21,5 +21,6 @@ export declare const createEventEnvelope: (stream: EventStreamType, deps: Depend
|
|
|
21
21
|
readonly stream: string;
|
|
22
22
|
readonly version: 1;
|
|
23
23
|
};
|
|
24
|
+
export declare function event<Schema extends v.ObjectSchema<any, any>>(schema: Schema, stream: EventStreamType, payload: v.InferOutput<Schema>["payload"], deps: Dependencies): v.InferOutput<Schema>;
|
|
24
25
|
export {};
|
|
25
26
|
//# sourceMappingURL=event-envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,YAAY,GAAG;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,mBAAmB;;;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,eAAe,EAAE,MAAM,YAAY;;;;;;CAOlE,CAAC"}
|
|
1
|
+
{"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,KAAK,YAAY,GAAG;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,mBAAmB;;;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,eAAe,EAAE,MAAM,YAAY;;;;;;CAOlE,CAAC;AAEd,wBAAgB,KAAK,CAAC,MAAM,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAC3D,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EACzC,IAAI,EAAE,YAAY,GACjB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAMvB"}
|
package/dist/event-envelope.js
CHANGED
|
@@ -18,4 +18,11 @@ export const createEventEnvelope = (stream, deps) => ({
|
|
|
18
18
|
stream,
|
|
19
19
|
version: 1,
|
|
20
20
|
});
|
|
21
|
+
export function event(schema, stream, payload, deps) {
|
|
22
|
+
return v.parse(schema, {
|
|
23
|
+
...createEventEnvelope(stream, deps),
|
|
24
|
+
name: schema.entries.name.literal,
|
|
25
|
+
payload,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
21
28
|
//# sourceMappingURL=event-envelope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-envelope.js","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,EAAE,EAAE,IAAI;IACR,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK,CAAC,cAAc;IAC/B,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAuB,EAAE,IAAkB,EAAE,EAAE,CACjF,CAAC;IACC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;IAC9B,aAAa,EAAE,kBAAkB,CAAC,GAAG,EAAE;IACvC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE;IAC9B,MAAM;IACN,OAAO,EAAE,CAAC;CACX,CAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"event-envelope.js","sourceRoot":"","sources":["../src/event-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAA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