@skillstew/common 1.0.13 → 1.0.14
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/build/events/CreateEvent.d.ts +3 -0
- package/build/events/CreateEvent.js +14 -0
- package/package.json +1 -1
- package/publish.sh +26 -0
- package/src/events/CreateEvent.ts +19 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateEvent = CreateEvent;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
function CreateEvent(eventName, data, producer, traceId) {
|
|
6
|
+
return {
|
|
7
|
+
eventName,
|
|
8
|
+
eventId: (0, crypto_1.randomUUID)(),
|
|
9
|
+
data,
|
|
10
|
+
producer,
|
|
11
|
+
timestamp: new Date().toISOString(),
|
|
12
|
+
traceId,
|
|
13
|
+
};
|
|
14
|
+
}
|
package/package.json
CHANGED
package/publish.sh
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Exit immediately on error
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
# Step 1: Bump patch version
|
|
7
|
+
npm version patch
|
|
8
|
+
|
|
9
|
+
# Step 2: Build the package
|
|
10
|
+
npm run build
|
|
11
|
+
|
|
12
|
+
# Step 3: Stage all changes
|
|
13
|
+
git add .
|
|
14
|
+
|
|
15
|
+
# Step 4: Prompt for a commit message
|
|
16
|
+
echo "Enter commit message:"
|
|
17
|
+
read COMMIT_MESSAGE
|
|
18
|
+
git commit -m "$COMMIT_MESSAGE"
|
|
19
|
+
|
|
20
|
+
# Step 5: Push to GitHub
|
|
21
|
+
echo "Enter remote branch to push to:"
|
|
22
|
+
read REMOTE_BRANCH
|
|
23
|
+
git push -u origin "$REMOTE_BRANCH"
|
|
24
|
+
|
|
25
|
+
# Step 6: Publish to npm
|
|
26
|
+
npm publish
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AppEvent } from "./AppEvent";
|
|
2
|
+
import { EventName, EventPayload } from "./EventMap";
|
|
3
|
+
import { randomUUID } from "crypto";
|
|
4
|
+
|
|
5
|
+
export function CreateEvent<T extends EventName>(
|
|
6
|
+
eventName: T,
|
|
7
|
+
data: EventPayload<T>,
|
|
8
|
+
producer: string,
|
|
9
|
+
traceId?: string,
|
|
10
|
+
): AppEvent<T> {
|
|
11
|
+
return {
|
|
12
|
+
eventName,
|
|
13
|
+
eventId: randomUUID(),
|
|
14
|
+
data,
|
|
15
|
+
producer,
|
|
16
|
+
timestamp: new Date().toISOString(),
|
|
17
|
+
traceId,
|
|
18
|
+
};
|
|
19
|
+
}
|