@causa/runtime-google 1.0.0-rc.1 → 1.0.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/dist/app-check/guard.js +3 -3
- package/dist/identity-platform/identity-platform.strategy.js +2 -2
- package/dist/pubsub/interceptor.js +2 -2
- package/dist/transaction/firestore-pubsub/readonly-state-transaction.d.ts +1 -1
- package/dist/transaction/firestore-pubsub/readonly-state-transaction.js +7 -6
- package/dist/transaction/firestore-pubsub/transaction.d.ts +1 -1
- package/dist/transaction/spanner-outbox/readonly-transaction.d.ts +1 -1
- package/dist/transaction/spanner-outbox/readonly-transaction.js +2 -1
- package/dist/transaction/spanner-outbox/transaction.d.ts +1 -1
- package/package.json +12 -11
package/dist/app-check/guard.js
CHANGED
|
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
var AppCheckGuard_1;
|
|
11
|
-
import { Logger,
|
|
11
|
+
import { Logger, throwHttpErrorResponse, UnauthenticatedErrorDto, } from '@causa/runtime/nestjs';
|
|
12
12
|
import { Injectable, } from '@nestjs/common';
|
|
13
13
|
import { Reflector } from '@nestjs/core';
|
|
14
14
|
import { AppCheck } from 'firebase-admin/app-check';
|
|
@@ -35,7 +35,7 @@ let AppCheckGuard = AppCheckGuard_1 = class AppCheckGuard {
|
|
|
35
35
|
const request = context.switchToHttp().getRequest();
|
|
36
36
|
const appCheckToken = request.headers['x-firebase-appcheck'];
|
|
37
37
|
if (!appCheckToken || typeof appCheckToken !== 'string') {
|
|
38
|
-
|
|
38
|
+
throwHttpErrorResponse(new UnauthenticatedErrorDto());
|
|
39
39
|
}
|
|
40
40
|
try {
|
|
41
41
|
await this.appCheck.verifyToken(appCheckToken);
|
|
@@ -43,7 +43,7 @@ let AppCheckGuard = AppCheckGuard_1 = class AppCheckGuard {
|
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
45
|
this.logger.warn({ error: error.stack }, 'App Check token verification failed.');
|
|
46
|
-
|
|
46
|
+
throwHttpErrorResponse(new UnauthenticatedErrorDto());
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
};
|
|
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
var IdentityPlatformStrategy_1;
|
|
11
|
-
import { Logger,
|
|
11
|
+
import { Logger, throwHttpErrorResponse, UnauthenticatedErrorDto, } from '@causa/runtime/nestjs';
|
|
12
12
|
import { Injectable } from '@nestjs/common';
|
|
13
13
|
import { ConfigService } from '@nestjs/config';
|
|
14
14
|
import { PassportStrategy } from '@nestjs/passport';
|
|
@@ -48,7 +48,7 @@ let IdentityPlatformStrategy = IdentityPlatformStrategy_1 = class IdentityPlatfo
|
|
|
48
48
|
else {
|
|
49
49
|
this.logger.warn({ error: error.stack }, 'Token verification failed.');
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
throwHttpErrorResponse(new UnauthenticatedErrorDto());
|
|
52
52
|
}
|
|
53
53
|
const user = {
|
|
54
54
|
...decodedToken,
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
var PubSubEventHandlerInterceptor_1;
|
|
11
11
|
import { AllowMissing, IsDateType, ValidateNestedType, ValidationError, parseObject, validateObject, } from '@causa/runtime';
|
|
12
|
-
import {
|
|
12
|
+
import { BadRequestErrorDto, BaseEventHandlerInterceptor, Logger, throwHttpErrorResponse, } from '@causa/runtime/nestjs';
|
|
13
13
|
import { Injectable } from '@nestjs/common';
|
|
14
14
|
import { Reflector } from '@nestjs/core';
|
|
15
15
|
import { IsBase64, IsObject, IsString } from 'class-validator';
|
|
@@ -110,7 +110,7 @@ let PubSubEventHandlerInterceptor = PubSubEventHandlerInterceptor_1 = class PubS
|
|
|
110
110
|
? { validationMessages: error.validationMessages }
|
|
111
111
|
: {}),
|
|
112
112
|
}, 'Received invalid Pub/Sub message.');
|
|
113
|
-
|
|
113
|
+
throwHttpErrorResponse(new BadRequestErrorDto());
|
|
114
114
|
}
|
|
115
115
|
this.logger.assign({ pubSubMessageId: message.messageId });
|
|
116
116
|
this.logger.info('Successfully parsed Pub/Sub message.');
|
|
@@ -33,5 +33,5 @@ export declare class FirestoreReadOnlyStateTransaction implements ReadOnlyStateT
|
|
|
33
33
|
* The resolver that provides the Firestore collections for a given document type.
|
|
34
34
|
*/
|
|
35
35
|
collectionResolver: FirestoreCollectionResolver);
|
|
36
|
-
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T |
|
|
36
|
+
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T | null>;
|
|
37
37
|
}
|
|
@@ -28,18 +28,19 @@ export class FirestoreReadOnlyStateTransaction {
|
|
|
28
28
|
const { activeCollection, softDelete } = this.collectionResolver.getCollectionsForType(type);
|
|
29
29
|
const activeDocRef = getReferenceForFirestoreDocument(activeCollection, entity, type);
|
|
30
30
|
const activeSnapshot = await this.firestoreTransaction.get(activeDocRef);
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const activeDocument = activeSnapshot.data();
|
|
32
|
+
if (activeDocument) {
|
|
33
|
+
return activeDocument;
|
|
33
34
|
}
|
|
34
35
|
if (!softDelete) {
|
|
35
|
-
return
|
|
36
|
+
return null;
|
|
36
37
|
}
|
|
37
38
|
const deletedDocRef = getReferenceForFirestoreDocument(softDelete.collection, entity, type);
|
|
38
39
|
const deletedSnapshot = await this.firestoreTransaction.get(deletedDocRef);
|
|
39
|
-
if (!deletedSnapshot.exists) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
40
|
const deletedDocument = deletedSnapshot.data();
|
|
41
|
+
if (!deletedDocument) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
43
44
|
delete deletedDocument[softDelete.expirationField];
|
|
44
45
|
return deletedDocument;
|
|
45
46
|
}
|
|
@@ -19,6 +19,6 @@ export declare class FirestorePubSubTransaction extends Transaction {
|
|
|
19
19
|
get firestoreTransaction(): FirestoreTransaction;
|
|
20
20
|
set<T extends object>(entity: T): Promise<void>;
|
|
21
21
|
delete<T extends object>(type: Type<T> | T, key?: Partial<T>): Promise<void>;
|
|
22
|
-
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T |
|
|
22
|
+
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T | null>;
|
|
23
23
|
publish(topic: string, event: object, options?: PublishOptions): Promise<void>;
|
|
24
24
|
}
|
|
@@ -18,5 +18,5 @@ export declare class SpannerReadOnlyStateTransaction implements ReadOnlyStateTra
|
|
|
18
18
|
* @param spannerTransaction The {@link SpannerReadWriteTransaction} or {@link SpannerReadOnlyTransaction} to use.
|
|
19
19
|
*/
|
|
20
20
|
constructor(entityManager: SpannerEntityManager, spannerTransaction: SpannerReadWriteTransaction | SpannerReadOnlyTransaction);
|
|
21
|
-
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T |
|
|
21
|
+
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T | null>;
|
|
22
22
|
}
|
|
@@ -17,9 +17,10 @@ export class SpannerReadOnlyStateTransaction {
|
|
|
17
17
|
}
|
|
18
18
|
async get(type, entity) {
|
|
19
19
|
const primaryKey = this.entityManager.getPrimaryKey(entity, type);
|
|
20
|
-
|
|
20
|
+
const row = await this.entityManager.findOneByKey(type, primaryKey, {
|
|
21
21
|
transaction: this.spannerTransaction,
|
|
22
22
|
includeSoftDeletes: true,
|
|
23
23
|
});
|
|
24
|
+
return row ?? null;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -23,6 +23,6 @@ export declare class SpannerOutboxTransaction extends Transaction implements Out
|
|
|
23
23
|
get entityManager(): SpannerEntityManager;
|
|
24
24
|
set<T extends object>(entity: T): Promise<void>;
|
|
25
25
|
delete<T extends object>(type: Type<T> | T, key?: Partial<T>): Promise<void>;
|
|
26
|
-
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T |
|
|
26
|
+
get<T extends object>(type: Type<T>, entity: Partial<T>): Promise<T | null>;
|
|
27
27
|
publish(topic: string, event: object, options?: PublishOptions): Promise<void>;
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@causa/runtime-google",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "An extension to the Causa runtime SDK (`@causa/runtime`), providing Google-specific features.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"test:cov": "npm run test -- --coverage"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@causa/runtime": "
|
|
35
|
+
"@causa/runtime": "^1.0.0",
|
|
36
36
|
"@google-cloud/precise-date": "^5.0.0",
|
|
37
37
|
"@google-cloud/pubsub": "^5.1.0",
|
|
38
38
|
"@google-cloud/spanner": "^8.0.0",
|
|
39
|
-
"@google-cloud/tasks": "^6.
|
|
39
|
+
"@google-cloud/tasks": "^6.2.0",
|
|
40
40
|
"@grpc/grpc-js": "^1.13.4",
|
|
41
|
-
"@nestjs/common": "^11.1.
|
|
41
|
+
"@nestjs/common": "^11.1.5",
|
|
42
42
|
"@nestjs/config": "^4.0.2",
|
|
43
|
-
"@nestjs/core": "^11.1.
|
|
43
|
+
"@nestjs/core": "^11.1.5",
|
|
44
44
|
"@nestjs/passport": "^11.0.5",
|
|
45
45
|
"@nestjs/terminus": "^11.0.0",
|
|
46
46
|
"class-transformer": "^0.5.1",
|
|
@@ -53,28 +53,29 @@
|
|
|
53
53
|
"reflect-metadata": "^0.2.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@nestjs/testing": "^11.1.
|
|
57
|
-
"@swc/core": "^1.
|
|
56
|
+
"@nestjs/testing": "^11.1.5",
|
|
57
|
+
"@swc/core": "^1.13.0",
|
|
58
58
|
"@swc/jest": "^0.2.39",
|
|
59
59
|
"@tsconfig/node22": "^22.0.2",
|
|
60
60
|
"@types/jest": "^30.0.0",
|
|
61
61
|
"@types/jsonwebtoken": "^9.0.10",
|
|
62
|
-
"@types/node": "^22.16.
|
|
62
|
+
"@types/node": "^22.16.4",
|
|
63
63
|
"@types/passport-http-bearer": "^1.0.41",
|
|
64
64
|
"@types/supertest": "^6.0.3",
|
|
65
65
|
"@types/uuid": "^10.0.0",
|
|
66
|
-
"dotenv": "^17.
|
|
67
|
-
"eslint": "^9.
|
|
66
|
+
"dotenv": "^17.2.0",
|
|
67
|
+
"eslint": "^9.31.0",
|
|
68
68
|
"eslint-config-prettier": "^10.1.5",
|
|
69
69
|
"eslint-plugin-prettier": "^5.5.1",
|
|
70
70
|
"jest": "^30.0.4",
|
|
71
71
|
"jest-extended": "^6.0.0",
|
|
72
|
+
"pino-pretty": "^13.0.0",
|
|
72
73
|
"rimraf": "^6.0.1",
|
|
73
74
|
"supertest": "^7.1.3",
|
|
74
75
|
"ts-jest": "^29.4.0",
|
|
75
76
|
"ts-node": "^10.9.2",
|
|
76
77
|
"typescript": "^5.8.3",
|
|
77
|
-
"typescript-eslint": "^8.
|
|
78
|
+
"typescript-eslint": "^8.37.0",
|
|
78
79
|
"uuid": "^11.1.0"
|
|
79
80
|
}
|
|
80
81
|
}
|