@pikku/mongodb 0.12.1 → 0.12.3
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 +36 -0
- package/dist/src/mongodb-secret-service.js +1 -1
- package/dist/src/mongodb-workflow-service.d.ts +1 -0
- package/dist/src/mongodb-workflow-service.js +11 -0
- package/dist/src/pikku-mongodb.js +1 -1
- package/package.json +4 -3
- package/src/mongodb-secret-service.ts +1 -1
- package/src/mongodb-workflow-service.ts +16 -0
- package/src/pikku-mongodb.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @pikku/mongodb
|
|
2
2
|
|
|
3
|
+
## 0.12.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a2ee6d0: Replace process.exit(1) with thrown error on MongoDB connection failure to allow graceful error handling.
|
|
8
|
+
- 87433f0: Validate state key names in updateRunState to prevent MongoDB operator injection.
|
|
9
|
+
- Updated dependencies [e412b4d]
|
|
10
|
+
- Updated dependencies [53dc8c8]
|
|
11
|
+
- Updated dependencies [0a1cc51]
|
|
12
|
+
- Updated dependencies [0a1cc51]
|
|
13
|
+
- Updated dependencies [0a1cc51]
|
|
14
|
+
- Updated dependencies [0a1cc51]
|
|
15
|
+
- Updated dependencies [0a1cc51]
|
|
16
|
+
- Updated dependencies [0a1cc51]
|
|
17
|
+
- Updated dependencies [0a1cc51]
|
|
18
|
+
- Updated dependencies [0a1cc51]
|
|
19
|
+
- Updated dependencies [0a1cc51]
|
|
20
|
+
- Updated dependencies [8b9b2e9]
|
|
21
|
+
- Updated dependencies [8b9b2e9]
|
|
22
|
+
- Updated dependencies [b973d44]
|
|
23
|
+
- Updated dependencies [8b9b2e9]
|
|
24
|
+
- Updated dependencies [8b9b2e9]
|
|
25
|
+
- @pikku/core@0.12.9
|
|
26
|
+
|
|
27
|
+
## 0.12.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 3e79248: Add setStepChildRunId to workflow service implementations and auto-bootstrap in pikku all
|
|
32
|
+
- Updated dependencies [bb27710]
|
|
33
|
+
- Updated dependencies [a31bc63]
|
|
34
|
+
- Updated dependencies [3e79248]
|
|
35
|
+
- Updated dependencies [b0a81cc]
|
|
36
|
+
- Updated dependencies [6413df7]
|
|
37
|
+
- @pikku/core@0.12.6
|
|
38
|
+
|
|
3
39
|
## 0.12.1
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -50,7 +50,7 @@ export class MongoDBSecretService {
|
|
|
50
50
|
async getSecret(key) {
|
|
51
51
|
const row = await this.secrets.findOne({ _id: key });
|
|
52
52
|
if (!row)
|
|
53
|
-
throw new Error(
|
|
53
|
+
throw new Error('Requested secret not found');
|
|
54
54
|
const kek = this.getKEK(row.keyVersion);
|
|
55
55
|
const result = await envelopeDecrypt(kek, row.ciphertext, row.wrappedDek);
|
|
56
56
|
await this.logAudit(key, 'read');
|
|
@@ -25,6 +25,7 @@ export declare class MongoDBWorkflowService extends PikkuWorkflowService {
|
|
|
25
25
|
setStepScheduled(stepId: string): Promise<void>;
|
|
26
26
|
private insertHistoryRecord;
|
|
27
27
|
private getTimestampFieldForStatus;
|
|
28
|
+
setStepChildRunId(stepId: string, childRunId: string): Promise<void>;
|
|
28
29
|
setStepResult(stepId: string, result: any): Promise<void>;
|
|
29
30
|
setStepError(stepId: string, error: Error): Promise<void>;
|
|
30
31
|
createRetryAttempt(stepId: string, status: 'pending' | 'running'): Promise<StepState>;
|
|
@@ -165,6 +165,14 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
|
|
|
165
165
|
return 'createdAt';
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
+
async setStepChildRunId(stepId, childRunId) {
|
|
169
|
+
await this.steps.updateOne({ _id: stepId }, {
|
|
170
|
+
$set: {
|
|
171
|
+
childRunId,
|
|
172
|
+
updatedAt: new Date(),
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
}
|
|
168
176
|
async setStepResult(stepId, result) {
|
|
169
177
|
await this.steps.updateOne({ _id: stepId }, {
|
|
170
178
|
$set: {
|
|
@@ -303,6 +311,9 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
|
|
|
303
311
|
await this.steps.updateOne({ _id: stepId }, { $set: { branchTaken: branchKey, updatedAt: new Date() } });
|
|
304
312
|
}
|
|
305
313
|
async updateRunState(runId, name, value) {
|
|
314
|
+
if (!/^[a-zA-Z0-9_]+$/.test(name)) {
|
|
315
|
+
throw new Error('Invalid state key name');
|
|
316
|
+
}
|
|
306
317
|
await this.runs.updateOne({ _id: runId }, {
|
|
307
318
|
$set: {
|
|
308
319
|
[`state.${name}`]: value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/mongodb",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/src/index.js",
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
"test": "bash run-tests.sh",
|
|
14
14
|
"test:watch": "bash run-tests.sh --watch",
|
|
15
15
|
"test:coverage": "bash run-tests.sh --coverage",
|
|
16
|
-
"release": "npm run build && npm test"
|
|
16
|
+
"release": "npm run build && npm test",
|
|
17
|
+
"prepublishOnly": "yarn build"
|
|
17
18
|
},
|
|
18
19
|
"peerDependencies": {
|
|
19
|
-
"@pikku/core": "^0.12.
|
|
20
|
+
"@pikku/core": "^0.12.9"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"mongodb": "^6.12.0"
|
|
@@ -89,7 +89,7 @@ export class MongoDBSecretService implements SecretService {
|
|
|
89
89
|
|
|
90
90
|
async getSecret(key: string): Promise<string> {
|
|
91
91
|
const row = await this.secrets.findOne({ _id: key })
|
|
92
|
-
if (!row) throw new Error(
|
|
92
|
+
if (!row) throw new Error('Requested secret not found')
|
|
93
93
|
|
|
94
94
|
const kek = this.getKEK(row.keyVersion)
|
|
95
95
|
const result = await envelopeDecrypt<string>(
|
|
@@ -34,6 +34,7 @@ interface WorkflowStepDoc {
|
|
|
34
34
|
status: string
|
|
35
35
|
result: any | null
|
|
36
36
|
error: any | null
|
|
37
|
+
childRunId?: string
|
|
37
38
|
branchTaken: string | null
|
|
38
39
|
retries: number | null
|
|
39
40
|
retryDelay: string | null
|
|
@@ -303,6 +304,18 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
|
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
306
|
|
|
307
|
+
async setStepChildRunId(stepId: string, childRunId: string): Promise<void> {
|
|
308
|
+
await this.steps.updateOne(
|
|
309
|
+
{ _id: stepId },
|
|
310
|
+
{
|
|
311
|
+
$set: {
|
|
312
|
+
childRunId,
|
|
313
|
+
updatedAt: new Date(),
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
|
|
306
319
|
async setStepResult(stepId: string, result: any): Promise<void> {
|
|
307
320
|
await this.steps.updateOne(
|
|
308
321
|
{ _id: stepId },
|
|
@@ -502,6 +515,9 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
|
|
|
502
515
|
name: string,
|
|
503
516
|
value: unknown
|
|
504
517
|
): Promise<void> {
|
|
518
|
+
if (!/^[a-zA-Z0-9_]+$/.test(name)) {
|
|
519
|
+
throw new Error('Invalid state key name')
|
|
520
|
+
}
|
|
505
521
|
await this.runs.updateOne(
|
|
506
522
|
{ _id: runId },
|
|
507
523
|
{
|