@causa/workspace-google 0.17.0 → 0.18.0-beta.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/configurations/schemas/google.yaml +37 -70
- package/dist/configurations/schemas/infrastructure.yaml +3 -5
- package/dist/configurations/schemas/service-container.yaml +7 -17
- package/dist/functions/emulator/start-firebase-storage.d.ts +1 -4
- package/dist/functions/emulator/start-firebase-storage.js +8 -11
- package/dist/functions/emulator/start-firestore.d.ts +1 -3
- package/dist/functions/emulator/start-firestore.js +8 -10
- package/dist/functions/emulator/start-identity-platform.d.ts +1 -4
- package/dist/functions/emulator/start-identity-platform.js +7 -10
- package/dist/functions/emulator/start-pubsub.call.d.ts +1 -2
- package/dist/functions/emulator/start-pubsub.call.js +2 -2
- package/dist/functions/emulator/start-pubsub.d.ts +1 -2
- package/dist/functions/emulator/start-pubsub.js +3 -3
- package/dist/functions/emulator/start-spanner.call.d.ts +1 -2
- package/dist/functions/emulator/start-spanner.call.js +2 -2
- package/dist/functions/emulator/start-spanner.d.ts +1 -2
- package/dist/functions/emulator/start-spanner.js +3 -3
- package/dist/functions/emulator/stop-firebase-storage.d.ts +1 -2
- package/dist/functions/emulator/stop-firebase-storage.js +5 -6
- package/dist/functions/emulator/stop-firestore.d.ts +1 -2
- package/dist/functions/emulator/stop-firestore.js +5 -6
- package/dist/functions/emulator/stop-identity-platform.d.ts +1 -2
- package/dist/functions/emulator/stop-identity-platform.js +5 -6
- package/dist/functions/emulator/stop-pubsub.d.ts +1 -2
- package/dist/functions/emulator/stop-pubsub.js +5 -6
- package/dist/functions/emulator/stop-spanner.d.ts +1 -2
- package/dist/functions/emulator/stop-spanner.js +5 -6
- package/dist/functions/event-topic/broker-create-topic-pubsub.call.d.ts +1 -2
- package/dist/functions/event-topic/broker-create-topic-pubsub.call.js +4 -4
- package/dist/functions/event-topic/broker-create-topic-pubsub.d.ts +2 -3
- package/dist/functions/event-topic/broker-create-topic-pubsub.js +7 -6
- package/dist/functions/event-topic/broker-create-trigger-cloud-run.call.d.ts +1 -2
- package/dist/functions/event-topic/broker-create-trigger-cloud-run.call.js +4 -4
- package/dist/functions/event-topic/broker-create-trigger-cloud-run.d.ts +2 -3
- package/dist/functions/event-topic/broker-create-trigger-cloud-run.js +8 -7
- package/dist/functions/event-topic/broker-delete-topic-pubsub.call.d.ts +1 -2
- package/dist/functions/event-topic/broker-delete-topic-pubsub.call.js +4 -4
- package/dist/functions/event-topic/broker-delete-topic-pubsub.d.ts +2 -3
- package/dist/functions/event-topic/broker-delete-topic-pubsub.js +7 -6
- package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.d.ts +1 -2
- package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.js +3 -3
- package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.d.ts +2 -3
- package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.js +7 -6
- package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.d.ts +1 -2
- package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.js +7 -4
- package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.d.ts +2 -3
- package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.js +7 -6
- package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.call.d.ts +1 -2
- package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.call.js +4 -4
- package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.d.ts +2 -3
- package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.js +7 -6
- package/dist/functions/event-topic/broker-get-topic-id-pubsub.d.ts +2 -3
- package/dist/functions/event-topic/broker-get-topic-id-pubsub.js +6 -6
- package/dist/functions/event-topic/broker-publish-events-google.call.d.ts +1 -2
- package/dist/functions/event-topic/broker-publish-events-google.call.js +6 -7
- package/dist/functions/event-topic/broker-publish-events-google.d.ts +2 -3
- package/dist/functions/event-topic/broker-publish-events-google.js +7 -6
- package/dist/functions/event-topic/create-backfill-source-bigquery.call.d.ts +1 -2
- package/dist/functions/event-topic/create-backfill-source-bigquery.call.js +4 -4
- package/dist/functions/event-topic/create-backfill-source-bigquery.d.ts +2 -3
- package/dist/functions/event-topic/create-backfill-source-bigquery.js +5 -5
- package/dist/functions/event-topic/query-events-bigquery.call.d.ts +1 -2
- package/dist/functions/event-topic/query-events-bigquery.call.js +4 -4
- package/dist/functions/event-topic/query-events-bigquery.d.ts +2 -3
- package/dist/functions/event-topic/query-events-bigquery.js +5 -5
- package/dist/functions/google-app-check/generate-token.call.d.ts +1 -2
- package/dist/functions/google-app-check/generate-token.call.js +3 -3
- package/dist/functions/google-app-check/generate-token.d.ts +2 -2
- package/dist/functions/google-app-check/generate-token.js +3 -3
- package/dist/functions/google-firebase-storage/merge-rules.d.ts +2 -2
- package/dist/functions/google-firebase-storage/merge-rules.js +4 -4
- package/dist/functions/google-firestore/extract-database.d.ts +11 -0
- package/dist/functions/google-firestore/extract-database.js +44 -0
- package/dist/functions/google-firestore/generate-typescript-decorators.d.ts +13 -0
- package/dist/functions/google-firestore/generate-typescript-decorators.js +78 -0
- package/dist/functions/google-firestore/index.d.ts +2 -0
- package/dist/functions/google-firestore/index.js +2 -0
- package/dist/functions/google-firestore/merge-rules.d.ts +2 -2
- package/dist/functions/google-firestore/merge-rules.js +4 -4
- package/dist/functions/google-firestore/query-records.call.d.ts +1 -2
- package/dist/functions/google-firestore/query-records.call.js +3 -3
- package/dist/functions/google-firestore/query-records.d.ts +1 -2
- package/dist/functions/google-firestore/query-records.js +3 -3
- package/dist/functions/google-identity-platform/generate-custom-token.call.d.ts +1 -2
- package/dist/functions/google-identity-platform/generate-custom-token.call.js +2 -2
- package/dist/functions/google-identity-platform/generate-custom-token.d.ts +2 -2
- package/dist/functions/google-identity-platform/generate-custom-token.js +3 -3
- package/dist/functions/google-identity-platform/generate-token.call.d.ts +1 -2
- package/dist/functions/google-identity-platform/generate-token.call.js +4 -4
- package/dist/functions/google-identity-platform/generate-token.d.ts +2 -2
- package/dist/functions/google-identity-platform/generate-token.js +3 -3
- package/dist/functions/google-pubsub/write-topics.d.ts +2 -3
- package/dist/functions/google-pubsub/write-topics.js +11 -12
- package/dist/functions/google-services/enable.call.d.ts +1 -2
- package/dist/functions/google-services/enable.call.js +3 -3
- package/dist/functions/google-services/enable.d.ts +2 -2
- package/dist/functions/google-services/enable.js +3 -3
- package/dist/functions/google-spanner/extract-database.d.ts +11 -0
- package/dist/functions/google-spanner/extract-database.js +25 -0
- package/dist/functions/google-spanner/generate-typescript-decorators.d.ts +14 -0
- package/dist/functions/google-spanner/generate-typescript-decorators.js +120 -0
- package/dist/functions/google-spanner/index.d.ts +2 -0
- package/dist/functions/google-spanner/index.js +2 -0
- package/dist/functions/google-spanner/list-databases.d.ts +2 -2
- package/dist/functions/google-spanner/list-databases.js +7 -7
- package/dist/functions/google-spanner/query-records.call.d.ts +1 -2
- package/dist/functions/google-spanner/query-records.call.js +4 -4
- package/dist/functions/google-spanner/query-records.d.ts +1 -2
- package/dist/functions/google-spanner/query-records.js +3 -3
- package/dist/functions/google-spanner/write-databases.d.ts +2 -3
- package/dist/functions/google-spanner/write-databases.js +11 -12
- package/dist/functions/index.js +3 -4
- package/dist/functions/project/get-artefact-destination-cloud-functions.d.ts +2 -3
- package/dist/functions/project/get-artefact-destination-cloud-functions.js +5 -6
- package/dist/functions/project/get-artefact-destination-cloud-run.d.ts +2 -3
- package/dist/functions/project/get-artefact-destination-cloud-run.js +5 -6
- package/dist/functions/project/push-artefact-cloud-functions.call.d.ts +1 -2
- package/dist/functions/project/push-artefact-cloud-functions.call.js +5 -5
- package/dist/functions/project/push-artefact-cloud-functions.d.ts +2 -3
- package/dist/functions/project/push-artefact-cloud-functions.js +5 -5
- package/dist/functions/secret/fetch-access-token.call.d.ts +1 -2
- package/dist/functions/secret/fetch-access-token.call.js +4 -2
- package/dist/functions/secret/fetch-access-token.d.ts +2 -2
- package/dist/functions/secret/fetch-access-token.js +3 -3
- package/dist/functions/secret/fetch-secret-manager.call.d.ts +1 -2
- package/dist/functions/secret/fetch-secret-manager.call.js +3 -3
- package/dist/functions/secret/fetch-secret-manager.d.ts +2 -2
- package/dist/functions/secret/fetch-secret-manager.js +3 -3
- package/dist/functions/service-container/query-logs-cloud-run.call.d.ts +1 -2
- package/dist/functions/service-container/query-logs-cloud-run.call.js +3 -3
- package/dist/functions/service-container/query-logs-cloud-run.d.ts +2 -3
- package/dist/functions/service-container/query-logs-cloud-run.js +5 -5
- package/package.json +16 -16
- package/dist/code-generation/google-firestore-renderer.d.ts +0 -12
- package/dist/code-generation/google-firestore-renderer.js +0 -89
- package/dist/code-generation/google-spanner-renderer.d.ts +0 -11
- package/dist/code-generation/google-spanner-renderer.js +0 -100
- package/dist/code-generation/index.d.ts +0 -2
- package/dist/code-generation/index.js +0 -2
- package/dist/code-generation/utils.d.ts +0 -12
- package/dist/code-generation/utils.js +0 -21
- package/dist/functions/typescript/get-decorator-renderer-google-firestore.d.ts +0 -9
- package/dist/functions/typescript/get-decorator-renderer-google-firestore.js +0 -15
- package/dist/functions/typescript/get-decorator-renderer-google-spanner.d.ts +0 -9
- package/dist/functions/typescript/get-decorator-renderer-google-spanner.js +0 -15
- package/dist/functions/typescript/index.d.ts +0 -2
- package/dist/functions/typescript/index.js +0 -2
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
import { DockerEmulatorService } from '@causa/workspace-core/services';
|
|
4
3
|
import { FIREBASE_STORAGE_EMULATOR_NAME, getFirebaseStorageContainerName, } from '../../emulators/index.js';
|
|
@@ -6,11 +5,11 @@ import { FIREBASE_STORAGE_EMULATOR_NAME, getFirebaseStorageContainerName, } from
|
|
|
6
5
|
* Implements {@link EmulatorStop} for the Firebase Storage emulator.
|
|
7
6
|
*/
|
|
8
7
|
export class EmulatorStopForFirebaseStorage extends EmulatorStop {
|
|
9
|
-
async _call(
|
|
10
|
-
const containerName = getFirebaseStorageContainerName(
|
|
11
|
-
|
|
12
|
-
await
|
|
13
|
-
|
|
8
|
+
async _call() {
|
|
9
|
+
const containerName = getFirebaseStorageContainerName(this._context);
|
|
10
|
+
this._context.logger.info('️🍱 Stopping Firebase Storage emulator.');
|
|
11
|
+
await this._context.service(DockerEmulatorService).stop(containerName);
|
|
12
|
+
this._context.logger.info('️🍱 Successfully stopped Firebase Storage emulator.');
|
|
14
13
|
return FIREBASE_STORAGE_EMULATOR_NAME;
|
|
15
14
|
}
|
|
16
15
|
_supports() {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EmulatorStop} for the Firestore emulator.
|
|
5
4
|
*/
|
|
6
5
|
export declare class EmulatorStopForFirestore extends EmulatorStop {
|
|
7
|
-
_call(
|
|
6
|
+
_call(): Promise<string>;
|
|
8
7
|
_supports(): boolean;
|
|
9
8
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
import { DockerEmulatorService } from '@causa/workspace-core/services';
|
|
4
3
|
import { FIRESTORE_EMULATOR_NAME, getFirestoreContainerName, } from '../../emulators/index.js';
|
|
@@ -6,11 +5,11 @@ import { FIRESTORE_EMULATOR_NAME, getFirestoreContainerName, } from '../../emula
|
|
|
6
5
|
* Implements {@link EmulatorStop} for the Firestore emulator.
|
|
7
6
|
*/
|
|
8
7
|
export class EmulatorStopForFirestore extends EmulatorStop {
|
|
9
|
-
async _call(
|
|
10
|
-
const containerName = getFirestoreContainerName(
|
|
11
|
-
|
|
12
|
-
await
|
|
13
|
-
|
|
8
|
+
async _call() {
|
|
9
|
+
const containerName = getFirestoreContainerName(this._context);
|
|
10
|
+
this._context.logger.info('️🗃️ Stopping Firestore emulator.');
|
|
11
|
+
await this._context.service(DockerEmulatorService).stop(containerName);
|
|
12
|
+
this._context.logger.info('️🗃️ Successfully stopped Firestore emulator.');
|
|
14
13
|
return FIRESTORE_EMULATOR_NAME;
|
|
15
14
|
}
|
|
16
15
|
_supports() {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EmulatorStop} for the Identity Platform emulator.
|
|
5
4
|
*/
|
|
6
5
|
export declare class EmulatorStopForIdentityPlatform extends EmulatorStop {
|
|
7
|
-
_call(
|
|
6
|
+
_call(): Promise<string>;
|
|
8
7
|
_supports(): boolean;
|
|
9
8
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
import { DockerEmulatorService } from '@causa/workspace-core/services';
|
|
4
3
|
import { IDENTITY_PLATFORM_EMULATOR_NAME, getIdentityPlatformContainerName, } from '../../emulators/index.js';
|
|
@@ -6,11 +5,11 @@ import { IDENTITY_PLATFORM_EMULATOR_NAME, getIdentityPlatformContainerName, } fr
|
|
|
6
5
|
* Implements {@link EmulatorStop} for the Identity Platform emulator.
|
|
7
6
|
*/
|
|
8
7
|
export class EmulatorStopForIdentityPlatform extends EmulatorStop {
|
|
9
|
-
async _call(
|
|
10
|
-
const containerName = getIdentityPlatformContainerName(
|
|
11
|
-
|
|
12
|
-
await
|
|
13
|
-
|
|
8
|
+
async _call() {
|
|
9
|
+
const containerName = getIdentityPlatformContainerName(this._context);
|
|
10
|
+
this._context.logger.info('️🛂 Stopping Identity Platform emulator.');
|
|
11
|
+
await this._context.service(DockerEmulatorService).stop(containerName);
|
|
12
|
+
this._context.logger.info('🛂 Successfully stopped Identity Platform emulator.');
|
|
14
13
|
return IDENTITY_PLATFORM_EMULATOR_NAME;
|
|
15
14
|
}
|
|
16
15
|
_supports() {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EmulatorStop} for the Pub/Sub emulator.
|
|
5
4
|
*/
|
|
6
5
|
export declare class EmulatorStopForPubSub extends EmulatorStop {
|
|
7
|
-
_call(
|
|
6
|
+
_call(): Promise<string>;
|
|
8
7
|
_supports(): boolean;
|
|
9
8
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
import { DockerEmulatorService } from '@causa/workspace-core/services';
|
|
4
3
|
import { PUBSUB_EMULATOR_NAME, getPubSubContainerName, } from '../../emulators/index.js';
|
|
@@ -6,11 +5,11 @@ import { PUBSUB_EMULATOR_NAME, getPubSubContainerName, } from '../../emulators/i
|
|
|
6
5
|
* Implements {@link EmulatorStop} for the Pub/Sub emulator.
|
|
7
6
|
*/
|
|
8
7
|
export class EmulatorStopForPubSub extends EmulatorStop {
|
|
9
|
-
async _call(
|
|
10
|
-
const containerName = getPubSubContainerName(
|
|
11
|
-
|
|
12
|
-
await
|
|
13
|
-
|
|
8
|
+
async _call() {
|
|
9
|
+
const containerName = getPubSubContainerName(this._context);
|
|
10
|
+
this._context.logger.info('️📫 Stopping Pub/Sub emulator.');
|
|
11
|
+
await this._context.service(DockerEmulatorService).stop(containerName);
|
|
12
|
+
this._context.logger.info('📫 Successfully stopped Pub/Sub emulator.');
|
|
14
13
|
return PUBSUB_EMULATOR_NAME;
|
|
15
14
|
}
|
|
16
15
|
_supports() {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EmulatorStop} for the Spanner emulator.
|
|
5
4
|
*/
|
|
6
5
|
export declare class EmulatorStopForSpanner extends EmulatorStop {
|
|
7
|
-
_call(
|
|
6
|
+
_call(): Promise<string>;
|
|
8
7
|
_supports(): boolean;
|
|
9
8
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EmulatorStop } from '@causa/workspace-core';
|
|
3
2
|
import { DockerEmulatorService } from '@causa/workspace-core/services';
|
|
4
3
|
import { SPANNER_EMULATOR_NAME, getSpannerContainerName, } from '../../emulators/index.js';
|
|
@@ -6,11 +5,11 @@ import { SPANNER_EMULATOR_NAME, getSpannerContainerName, } from '../../emulators
|
|
|
6
5
|
* Implements {@link EmulatorStop} for the Spanner emulator.
|
|
7
6
|
*/
|
|
8
7
|
export class EmulatorStopForSpanner extends EmulatorStop {
|
|
9
|
-
async _call(
|
|
10
|
-
const containerName = getSpannerContainerName(
|
|
11
|
-
|
|
12
|
-
await
|
|
13
|
-
|
|
8
|
+
async _call() {
|
|
9
|
+
const containerName = getSpannerContainerName(this._context);
|
|
10
|
+
this._context.logger.info('️️🗃️ Stopping Spanner emulator.');
|
|
11
|
+
await this._context.service(DockerEmulatorService).stop(containerName);
|
|
12
|
+
this._context.logger.info('️🗃️ Successfully stopped Spanner emulator.');
|
|
14
13
|
return SPANNER_EMULATOR_NAME;
|
|
15
14
|
}
|
|
16
15
|
_supports() {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import type { EventTopicBrokerCreateTopicForPubSub } from './broker-create-topic-pubsub.js';
|
|
3
|
-
export default function call(this: EventTopicBrokerCreateTopicForPubSub
|
|
2
|
+
export default function call(this: EventTopicBrokerCreateTopicForPubSub): Promise<string>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PubSubService } from '../../services/pubsub.js';
|
|
2
|
-
export default async function call(
|
|
3
|
-
const googleConf =
|
|
2
|
+
export default async function call() {
|
|
3
|
+
const googleConf = this._context.asConfiguration();
|
|
4
4
|
const projectId = googleConf.getOrThrow('google.project');
|
|
5
5
|
const region = googleConf.get('google.region');
|
|
6
6
|
const topicId = `projects/${projectId}/topics/${this.name}`;
|
|
7
|
-
|
|
8
|
-
await
|
|
7
|
+
this._context.logger.info(`📫 Creating Pub/Sub topic '${topicId}'.`);
|
|
8
|
+
await this._context.service(PubSubService).pubSub.createTopic({
|
|
9
9
|
name: topicId,
|
|
10
10
|
...(region
|
|
11
11
|
? { messageStoragePolicy: { allowedPersistenceRegions: [region] } }
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerCreateTopic } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EventTopicBrokerCreateTopic} for Pub/Sub.
|
|
@@ -6,6 +5,6 @@ import { EventTopicBrokerCreateTopic } from '@causa/workspace-core';
|
|
|
6
5
|
* If a `google.region` configuration is set, the message storage policy for the topic is set accordingly.
|
|
7
6
|
*/
|
|
8
7
|
export declare class EventTopicBrokerCreateTopicForPubSub extends EventTopicBrokerCreateTopic {
|
|
9
|
-
_call(
|
|
10
|
-
_supports(
|
|
8
|
+
_call(): Promise<string>;
|
|
9
|
+
_supports(): boolean;
|
|
11
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callDeferred
|
|
1
|
+
import { callDeferred } from '@causa/workspace';
|
|
2
2
|
import { EventTopicBrokerCreateTopic, } from '@causa/workspace-core';
|
|
3
3
|
/**
|
|
4
4
|
* Implements {@link EventTopicBrokerCreateTopic} for Pub/Sub.
|
|
@@ -6,11 +6,12 @@ import { EventTopicBrokerCreateTopic, } from '@causa/workspace-core';
|
|
|
6
6
|
* If a `google.region` configuration is set, the message storage policy for the topic is set accordingly.
|
|
7
7
|
*/
|
|
8
8
|
export class EventTopicBrokerCreateTopicForPubSub extends EventTopicBrokerCreateTopic {
|
|
9
|
-
async _call(
|
|
10
|
-
return await callDeferred(this,
|
|
9
|
+
async _call() {
|
|
10
|
+
return await callDeferred(this, import.meta.url);
|
|
11
11
|
}
|
|
12
|
-
_supports(
|
|
13
|
-
return (
|
|
14
|
-
|
|
12
|
+
_supports() {
|
|
13
|
+
return (this._context
|
|
14
|
+
.asConfiguration()
|
|
15
|
+
.get('events.broker') === 'google.pubSub');
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { type EventTopicBrokerCreateTriggerForCloudRun } from './broker-create-trigger-cloud-run.js';
|
|
3
|
-
export default function call(this: EventTopicBrokerCreateTriggerForCloudRun
|
|
2
|
+
export default function call(this: EventTopicBrokerCreateTriggerForCloudRun): Promise<string[]>;
|
|
@@ -44,11 +44,11 @@ function resolveFromObject(context, trigger) {
|
|
|
44
44
|
path,
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
export default async function call(
|
|
47
|
+
export default async function call() {
|
|
48
48
|
const { serviceId, path } = typeof this.trigger === 'string'
|
|
49
|
-
? resolveFromString(
|
|
50
|
-
: resolveFromObject(
|
|
51
|
-
return await
|
|
49
|
+
? resolveFromString(this._context, this.trigger)
|
|
50
|
+
: resolveFromObject(this._context, this.trigger);
|
|
51
|
+
return await this._context
|
|
52
52
|
.service(CloudRunPubSubTriggerService)
|
|
53
53
|
.create(this.backfillId, this.topicId, serviceId, path);
|
|
54
54
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerCreateTrigger } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* The regular expression used to match Cloud Run trigger IDs, consisting of the service ID and the path to the trigger.
|
|
@@ -15,6 +14,6 @@ export declare const CLOUD_RUN_TRIGGER_ID_REGEX: RegExp;
|
|
|
15
14
|
* `serviceContainer.triggers` whose endpoint is of type `http`. Options are forwarded as URL query parameters.
|
|
16
15
|
*/
|
|
17
16
|
export declare class EventTopicBrokerCreateTriggerForCloudRun extends EventTopicBrokerCreateTrigger {
|
|
18
|
-
_call(
|
|
19
|
-
_supports(
|
|
17
|
+
_call(): Promise<string[]>;
|
|
18
|
+
_supports(): boolean;
|
|
20
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callDeferred
|
|
1
|
+
import { callDeferred } from '@causa/workspace';
|
|
2
2
|
import { EventTopicBrokerCreateTrigger, } from '@causa/workspace-core';
|
|
3
3
|
/**
|
|
4
4
|
* The regular expression used to match Cloud Run trigger IDs, consisting of the service ID and the path to the trigger.
|
|
@@ -15,19 +15,20 @@ export const CLOUD_RUN_TRIGGER_ID_REGEX = /^(?:(?:projects\/(?<projectId>[\w-]+)
|
|
|
15
15
|
* `serviceContainer.triggers` whose endpoint is of type `http`. Options are forwarded as URL query parameters.
|
|
16
16
|
*/
|
|
17
17
|
export class EventTopicBrokerCreateTriggerForCloudRun extends EventTopicBrokerCreateTrigger {
|
|
18
|
-
async _call(
|
|
19
|
-
return await callDeferred(this,
|
|
18
|
+
async _call() {
|
|
19
|
+
return await callDeferred(this, import.meta.url);
|
|
20
20
|
}
|
|
21
|
-
_supports(
|
|
22
|
-
const isPubSub =
|
|
23
|
-
|
|
21
|
+
_supports() {
|
|
22
|
+
const isPubSub = this._context
|
|
23
|
+
.asConfiguration()
|
|
24
|
+
.get('events.broker') === 'google.pubSub';
|
|
24
25
|
if (!isPubSub) {
|
|
25
26
|
return false;
|
|
26
27
|
}
|
|
27
28
|
if (typeof this.trigger === 'string') {
|
|
28
29
|
return CLOUD_RUN_TRIGGER_ID_REGEX.test(this.trigger);
|
|
29
30
|
}
|
|
30
|
-
const conf =
|
|
31
|
+
const conf = this._context.asConfiguration();
|
|
31
32
|
return (conf.get('project.type') === 'serviceContainer' &&
|
|
32
33
|
conf.get('serviceContainer.platform') === 'google.cloudRun');
|
|
33
34
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import type { EventTopicBrokerDeleteTopicForPubSub } from './broker-delete-topic-pubsub.js';
|
|
3
|
-
export default function call(this: EventTopicBrokerDeleteTopicForPubSub
|
|
2
|
+
export default function call(this: EventTopicBrokerDeleteTopicForPubSub): Promise<void>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { grpc } from 'google-gax';
|
|
2
2
|
import { PubSubService } from '../../services/pubsub.js';
|
|
3
|
-
export default async function call(
|
|
4
|
-
|
|
3
|
+
export default async function call() {
|
|
4
|
+
this._context.logger.info(`📫 Deleting Pub/Sub topic '${this.id}'.`);
|
|
5
5
|
try {
|
|
6
|
-
await
|
|
6
|
+
await this._context.service(PubSubService).pubSub.topic(this.id).delete();
|
|
7
7
|
}
|
|
8
8
|
catch (error) {
|
|
9
9
|
if (error.code === grpc.status.NOT_FOUND) {
|
|
10
|
-
|
|
10
|
+
this._context.logger.warn(`⚠️ Pub/Sub topic to delete '${this.id}' does not exist. It might have already been deleted.`);
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
throw error;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerDeleteTopic } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EventTopicBrokerDeleteTopic} for Pub/Sub.
|
|
5
4
|
* The `id` argument should be a full Pub/Sub topic ID, e.g. `projects/<projectId>/topics/<topicId>`.
|
|
6
5
|
*/
|
|
7
6
|
export declare class EventTopicBrokerDeleteTopicForPubSub extends EventTopicBrokerDeleteTopic {
|
|
8
|
-
_call(
|
|
9
|
-
_supports(
|
|
7
|
+
_call(): Promise<void>;
|
|
8
|
+
_supports(): boolean;
|
|
10
9
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { callDeferred
|
|
1
|
+
import { callDeferred } from '@causa/workspace';
|
|
2
2
|
import { EventTopicBrokerDeleteTopic, } from '@causa/workspace-core';
|
|
3
3
|
/**
|
|
4
4
|
* Implements {@link EventTopicBrokerDeleteTopic} for Pub/Sub.
|
|
5
5
|
* The `id` argument should be a full Pub/Sub topic ID, e.g. `projects/<projectId>/topics/<topicId>`.
|
|
6
6
|
*/
|
|
7
7
|
export class EventTopicBrokerDeleteTopicForPubSub extends EventTopicBrokerDeleteTopic {
|
|
8
|
-
async _call(
|
|
9
|
-
return await callDeferred(this,
|
|
8
|
+
async _call() {
|
|
9
|
+
return await callDeferred(this, import.meta.url);
|
|
10
10
|
}
|
|
11
|
-
_supports(
|
|
12
|
-
return (
|
|
13
|
-
|
|
11
|
+
_supports() {
|
|
12
|
+
return (this._context
|
|
13
|
+
.asConfiguration()
|
|
14
|
+
.get('events.broker') === 'google.pubSub');
|
|
14
15
|
}
|
|
15
16
|
}
|
package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import type { EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole } from './broker-delete-trigger-resource-cloud-run-invoker-role.js';
|
|
3
|
-
export default function call(this: EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole
|
|
2
|
+
export default function call(this: EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole): Promise<void>;
|
package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.js
CHANGED
|
@@ -3,14 +3,14 @@ import { CloudRunService } from '../../services/cloud-run.js';
|
|
|
3
3
|
* The regular expression that matches a resource ID representing a Cloud Run invoker role for a given service account.
|
|
4
4
|
*/
|
|
5
5
|
const CLOUD_RUN_INVOKER_ID_REGEX = /^(?<serviceId>projects\/[\w-]+\/locations\/[\w-]+\/services\/[\w-]+)\/invokerBindings\/(?<pubSubServiceAccount>.+)$/;
|
|
6
|
-
export default async function call(
|
|
6
|
+
export default async function call() {
|
|
7
7
|
const match = this.id.match(CLOUD_RUN_INVOKER_ID_REGEX);
|
|
8
8
|
if (!match?.groups) {
|
|
9
9
|
throw new Error('Invalid Cloud Run invoker binding resource ID.');
|
|
10
10
|
}
|
|
11
11
|
const { serviceId, pubSubServiceAccount } = match.groups;
|
|
12
|
-
|
|
13
|
-
await
|
|
12
|
+
this._context.logger.info(`🛂 Removing invoker role on Cloud Run service '${serviceId}' for Pub/Sub service account '${pubSubServiceAccount}'.`);
|
|
13
|
+
await this._context
|
|
14
14
|
.service(CloudRunService)
|
|
15
15
|
.removeInvokerBinding(serviceId, pubSubServiceAccount);
|
|
16
16
|
}
|
package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerDeleteTriggerResource } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EventTopicBrokerDeleteTriggerResource} for Cloud Run invoker roles.
|
|
@@ -6,6 +5,6 @@ import { EventTopicBrokerDeleteTriggerResource } from '@causa/workspace-core';
|
|
|
6
5
|
* a dedicated service account to invoke the service. This function removes that binding.
|
|
7
6
|
*/
|
|
8
7
|
export declare class EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole extends EventTopicBrokerDeleteTriggerResource {
|
|
9
|
-
_call(
|
|
10
|
-
_supports(
|
|
8
|
+
_call(): Promise<void>;
|
|
9
|
+
_supports(): boolean;
|
|
11
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callDeferred
|
|
1
|
+
import { callDeferred } from '@causa/workspace';
|
|
2
2
|
import { EventTopicBrokerDeleteTriggerResource, } from '@causa/workspace-core';
|
|
3
3
|
/**
|
|
4
4
|
* The regular expression that matches a resource ID representing a Cloud Run invoker role for a given service account.
|
|
@@ -10,12 +10,13 @@ const CLOUD_RUN_INVOKER_ID_REGEX = /^(?<serviceId>projects\/[\w-]+\/locations\/[
|
|
|
10
10
|
* a dedicated service account to invoke the service. This function removes that binding.
|
|
11
11
|
*/
|
|
12
12
|
export class EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole extends EventTopicBrokerDeleteTriggerResource {
|
|
13
|
-
async _call(
|
|
14
|
-
return await callDeferred(this,
|
|
13
|
+
async _call() {
|
|
14
|
+
return await callDeferred(this, import.meta.url);
|
|
15
15
|
}
|
|
16
|
-
_supports(
|
|
16
|
+
_supports() {
|
|
17
17
|
return (this.id.match(CLOUD_RUN_INVOKER_ID_REGEX) != null &&
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
this._context
|
|
19
|
+
.asConfiguration()
|
|
20
|
+
.get('events.broker') === 'google.pubSub');
|
|
20
21
|
}
|
|
21
22
|
}
|
package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import type { EventTopicBrokerDeleteTriggerResourceForPubSubSubscription } from './broker-delete-trigger-resource-pubsub-subscription.js';
|
|
3
|
-
export default function call(this: EventTopicBrokerDeleteTriggerResourceForPubSubSubscription
|
|
2
|
+
export default function call(this: EventTopicBrokerDeleteTriggerResourceForPubSubSubscription): Promise<void>;
|
package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { grpc } from 'google-gax';
|
|
2
2
|
import { PubSubService } from '../../services/pubsub.js';
|
|
3
|
-
export default async function call(
|
|
4
|
-
|
|
3
|
+
export default async function call() {
|
|
4
|
+
this._context.logger.info(`📫 Deleting Pub/Sub subscription '${this.id}'.`);
|
|
5
5
|
try {
|
|
6
|
-
await
|
|
6
|
+
await this._context
|
|
7
|
+
.service(PubSubService)
|
|
8
|
+
.pubSub.subscription(this.id)
|
|
9
|
+
.delete();
|
|
7
10
|
}
|
|
8
11
|
catch (error) {
|
|
9
12
|
if (error.code === grpc.status.NOT_FOUND) {
|
|
10
|
-
|
|
13
|
+
this._context.logger.warn(`⚠️ Pub/Sub subscription '${this.id}' does not exist. It might have already been deleted.`);
|
|
11
14
|
}
|
|
12
15
|
else {
|
|
13
16
|
throw error;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerDeleteTriggerResource } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EventTopicBrokerDeleteTriggerResource} for Pub/Sub subscriptions.
|
|
5
4
|
* Pub/Sub subscriptions are for example used when creating Cloud Run triggers.
|
|
6
5
|
*/
|
|
7
6
|
export declare class EventTopicBrokerDeleteTriggerResourceForPubSubSubscription extends EventTopicBrokerDeleteTriggerResource {
|
|
8
|
-
_call(
|
|
9
|
-
_supports(
|
|
7
|
+
_call(): Promise<void>;
|
|
8
|
+
_supports(): boolean;
|
|
10
9
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { callDeferred
|
|
1
|
+
import { callDeferred } from '@causa/workspace';
|
|
2
2
|
import { EventTopicBrokerDeleteTriggerResource, } from '@causa/workspace-core';
|
|
3
3
|
/**
|
|
4
4
|
* Implements {@link EventTopicBrokerDeleteTriggerResource} for Pub/Sub subscriptions.
|
|
5
5
|
* Pub/Sub subscriptions are for example used when creating Cloud Run triggers.
|
|
6
6
|
*/
|
|
7
7
|
export class EventTopicBrokerDeleteTriggerResourceForPubSubSubscription extends EventTopicBrokerDeleteTriggerResource {
|
|
8
|
-
async _call(
|
|
9
|
-
return await callDeferred(this,
|
|
8
|
+
async _call() {
|
|
9
|
+
return await callDeferred(this, import.meta.url);
|
|
10
10
|
}
|
|
11
|
-
_supports(
|
|
11
|
+
_supports() {
|
|
12
12
|
return (this.id.match(/^projects\/[\w-]+\/subscriptions\/[\w-]+$/) != null &&
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
this._context
|
|
14
|
+
.asConfiguration()
|
|
15
|
+
.get('events.broker') === 'google.pubSub');
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import type { EventTopicBrokerDeleteTriggerResourceForServiceAccount } from './broker-delete-trigger-resource-service-account.js';
|
|
3
|
-
export default function call(this: EventTopicBrokerDeleteTriggerResourceForServiceAccount
|
|
2
|
+
export default function call(this: EventTopicBrokerDeleteTriggerResourceForServiceAccount): Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IamService } from '../../services/iam.js';
|
|
2
|
-
export default async function call(
|
|
3
|
-
|
|
2
|
+
export default async function call() {
|
|
3
|
+
this._context.logger.info(`🛂 Deleting Pub/Sub backfilling service account '${this.id}'.`);
|
|
4
4
|
try {
|
|
5
|
-
await
|
|
5
|
+
await this._context.service(IamService).deleteServiceAccount(this.id);
|
|
6
6
|
}
|
|
7
7
|
catch (error) {
|
|
8
8
|
if (error.code === 404) {
|
|
9
|
-
|
|
9
|
+
this._context.logger.warn(`⚠️ Pub/Sub backfilling service account '${this.id}' does not exist. It might have already been deleted.`);
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
12
|
throw error;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerDeleteTriggerResource } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EventTopicBrokerDeleteTriggerResource} for GCP service accounts.
|
|
@@ -6,6 +5,6 @@ import { EventTopicBrokerDeleteTriggerResource } from '@causa/workspace-core';
|
|
|
6
5
|
* Run services).
|
|
7
6
|
*/
|
|
8
7
|
export declare class EventTopicBrokerDeleteTriggerResourceForServiceAccount extends EventTopicBrokerDeleteTriggerResource {
|
|
9
|
-
_call(
|
|
10
|
-
_supports(
|
|
8
|
+
_call(): Promise<void>;
|
|
9
|
+
_supports(): boolean;
|
|
11
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callDeferred
|
|
1
|
+
import { callDeferred } from '@causa/workspace';
|
|
2
2
|
import { EventTopicBrokerDeleteTriggerResource, } from '@causa/workspace-core';
|
|
3
3
|
/**
|
|
4
4
|
* Implements {@link EventTopicBrokerDeleteTriggerResource} for GCP service accounts.
|
|
@@ -6,12 +6,13 @@ import { EventTopicBrokerDeleteTriggerResource, } from '@causa/workspace-core';
|
|
|
6
6
|
* Run services).
|
|
7
7
|
*/
|
|
8
8
|
export class EventTopicBrokerDeleteTriggerResourceForServiceAccount extends EventTopicBrokerDeleteTriggerResource {
|
|
9
|
-
async _call(
|
|
10
|
-
return await callDeferred(this,
|
|
9
|
+
async _call() {
|
|
10
|
+
return await callDeferred(this, import.meta.url);
|
|
11
11
|
}
|
|
12
|
-
_supports(
|
|
12
|
+
_supports() {
|
|
13
13
|
return (this.id.match(/^projects\/[\w-]+\/serviceAccounts\/[^/]+$/) != null &&
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
this._context
|
|
15
|
+
.asConfiguration()
|
|
16
|
+
.get('events.broker') === 'google.pubSub');
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerGetTopicId } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EventTopicBrokerGetTopicId} for Pub/Sub.
|
|
5
4
|
* The returned topic ID is a full Pub/Sub topic ID, e.g. `projects/<projectId>/topics/<topicId>`.
|
|
6
5
|
*/
|
|
7
6
|
export declare class EventTopicBrokerGetTopicIdForPubSub extends EventTopicBrokerGetTopicId {
|
|
8
|
-
_call(
|
|
9
|
-
_supports(
|
|
7
|
+
_call(): Promise<string>;
|
|
8
|
+
_supports(): boolean;
|
|
10
9
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import { EventTopicBrokerGetTopicId, } from '@causa/workspace-core';
|
|
3
2
|
/**
|
|
4
3
|
* Implements {@link EventTopicBrokerGetTopicId} for Pub/Sub.
|
|
5
4
|
* The returned topic ID is a full Pub/Sub topic ID, e.g. `projects/<projectId>/topics/<topicId>`.
|
|
6
5
|
*/
|
|
7
6
|
export class EventTopicBrokerGetTopicIdForPubSub extends EventTopicBrokerGetTopicId {
|
|
8
|
-
async _call(
|
|
9
|
-
const googleConf =
|
|
7
|
+
async _call() {
|
|
8
|
+
const googleConf = this._context.asConfiguration();
|
|
10
9
|
const projectId = googleConf.getOrThrow('google.project');
|
|
11
10
|
return `projects/${projectId}/topics/${this.eventTopic}`;
|
|
12
11
|
}
|
|
13
|
-
_supports(
|
|
14
|
-
return (
|
|
15
|
-
|
|
12
|
+
_supports() {
|
|
13
|
+
return (this._context
|
|
14
|
+
.asConfiguration()
|
|
15
|
+
.get('events.broker') === 'google.pubSub');
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { WorkspaceContext } from '@causa/workspace';
|
|
2
1
|
import type { EventTopicBrokerPublishEventsForGoogle } from './broker-publish-events-google.js';
|
|
3
|
-
export default function call(this: EventTopicBrokerPublishEventsForGoogle
|
|
2
|
+
export default function call(this: EventTopicBrokerPublishEventsForGoogle): Promise<void>;
|