@causa/workspace-google 0.16.0 → 0.18.0-beta.1

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.
Files changed (142) hide show
  1. package/README.md +8 -0
  2. package/dist/configurations/schemas/google.yaml +37 -70
  3. package/dist/configurations/schemas/infrastructure.yaml +3 -5
  4. package/dist/configurations/schemas/service-container.yaml +7 -17
  5. package/dist/functions/emulator/start-firebase-storage.d.ts +1 -4
  6. package/dist/functions/emulator/start-firebase-storage.js +8 -11
  7. package/dist/functions/emulator/start-firestore.d.ts +1 -3
  8. package/dist/functions/emulator/start-firestore.js +8 -10
  9. package/dist/functions/emulator/start-identity-platform.d.ts +1 -4
  10. package/dist/functions/emulator/start-identity-platform.js +7 -10
  11. package/dist/functions/emulator/start-pubsub.call.d.ts +1 -2
  12. package/dist/functions/emulator/start-pubsub.call.js +2 -2
  13. package/dist/functions/emulator/start-pubsub.d.ts +1 -2
  14. package/dist/functions/emulator/start-pubsub.js +3 -3
  15. package/dist/functions/emulator/start-spanner.call.d.ts +1 -2
  16. package/dist/functions/emulator/start-spanner.call.js +2 -2
  17. package/dist/functions/emulator/start-spanner.d.ts +1 -2
  18. package/dist/functions/emulator/start-spanner.js +3 -3
  19. package/dist/functions/emulator/stop-firebase-storage.d.ts +1 -2
  20. package/dist/functions/emulator/stop-firebase-storage.js +5 -6
  21. package/dist/functions/emulator/stop-firestore.d.ts +1 -2
  22. package/dist/functions/emulator/stop-firestore.js +5 -6
  23. package/dist/functions/emulator/stop-identity-platform.d.ts +1 -2
  24. package/dist/functions/emulator/stop-identity-platform.js +5 -6
  25. package/dist/functions/emulator/stop-pubsub.d.ts +1 -2
  26. package/dist/functions/emulator/stop-pubsub.js +5 -6
  27. package/dist/functions/emulator/stop-spanner.d.ts +1 -2
  28. package/dist/functions/emulator/stop-spanner.js +5 -6
  29. package/dist/functions/event-topic/broker-create-topic-pubsub.call.d.ts +1 -2
  30. package/dist/functions/event-topic/broker-create-topic-pubsub.call.js +4 -4
  31. package/dist/functions/event-topic/broker-create-topic-pubsub.d.ts +2 -3
  32. package/dist/functions/event-topic/broker-create-topic-pubsub.js +7 -6
  33. package/dist/functions/event-topic/broker-create-trigger-cloud-run.call.d.ts +1 -2
  34. package/dist/functions/event-topic/broker-create-trigger-cloud-run.call.js +4 -4
  35. package/dist/functions/event-topic/broker-create-trigger-cloud-run.d.ts +2 -3
  36. package/dist/functions/event-topic/broker-create-trigger-cloud-run.js +8 -7
  37. package/dist/functions/event-topic/broker-delete-topic-pubsub.call.d.ts +1 -2
  38. package/dist/functions/event-topic/broker-delete-topic-pubsub.call.js +4 -4
  39. package/dist/functions/event-topic/broker-delete-topic-pubsub.d.ts +2 -3
  40. package/dist/functions/event-topic/broker-delete-topic-pubsub.js +7 -6
  41. package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.d.ts +1 -2
  42. package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.js +3 -3
  43. package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.d.ts +2 -3
  44. package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.js +7 -6
  45. package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.d.ts +1 -2
  46. package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.js +7 -4
  47. package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.d.ts +2 -3
  48. package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.js +7 -6
  49. package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.call.d.ts +1 -2
  50. package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.call.js +4 -4
  51. package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.d.ts +2 -3
  52. package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.js +7 -6
  53. package/dist/functions/event-topic/broker-get-topic-id-pubsub.d.ts +2 -3
  54. package/dist/functions/event-topic/broker-get-topic-id-pubsub.js +6 -6
  55. package/dist/functions/event-topic/broker-publish-events-google.call.d.ts +1 -2
  56. package/dist/functions/event-topic/broker-publish-events-google.call.js +6 -7
  57. package/dist/functions/event-topic/broker-publish-events-google.d.ts +2 -3
  58. package/dist/functions/event-topic/broker-publish-events-google.js +7 -6
  59. package/dist/functions/event-topic/create-backfill-source-bigquery.call.d.ts +1 -2
  60. package/dist/functions/event-topic/create-backfill-source-bigquery.call.js +4 -4
  61. package/dist/functions/event-topic/create-backfill-source-bigquery.d.ts +2 -3
  62. package/dist/functions/event-topic/create-backfill-source-bigquery.js +5 -5
  63. package/dist/functions/event-topic/index.d.ts +1 -0
  64. package/dist/functions/event-topic/index.js +1 -0
  65. package/dist/functions/event-topic/query-events-bigquery.call.d.ts +3 -0
  66. package/dist/functions/event-topic/query-events-bigquery.call.js +41 -0
  67. package/dist/functions/event-topic/query-events-bigquery.d.ts +9 -0
  68. package/dist/functions/event-topic/query-events-bigquery.js +17 -0
  69. package/dist/functions/google-app-check/generate-token.call.d.ts +1 -2
  70. package/dist/functions/google-app-check/generate-token.call.js +3 -3
  71. package/dist/functions/google-app-check/generate-token.d.ts +2 -2
  72. package/dist/functions/google-app-check/generate-token.js +3 -3
  73. package/dist/functions/google-firebase-storage/merge-rules.d.ts +2 -2
  74. package/dist/functions/google-firebase-storage/merge-rules.js +4 -4
  75. package/dist/functions/google-firestore/extract-database.d.ts +11 -0
  76. package/dist/functions/google-firestore/extract-database.js +44 -0
  77. package/dist/functions/google-firestore/index.d.ts +2 -0
  78. package/dist/functions/google-firestore/index.js +2 -0
  79. package/dist/functions/google-firestore/merge-rules.d.ts +2 -2
  80. package/dist/functions/google-firestore/merge-rules.js +4 -4
  81. package/dist/functions/google-firestore/query-records.call.d.ts +2 -0
  82. package/dist/functions/google-firestore/query-records.call.js +50 -0
  83. package/dist/functions/google-firestore/query-records.d.ts +17 -0
  84. package/dist/functions/google-firestore/query-records.js +22 -0
  85. package/dist/functions/google-identity-platform/generate-custom-token.call.d.ts +1 -2
  86. package/dist/functions/google-identity-platform/generate-custom-token.call.js +2 -2
  87. package/dist/functions/google-identity-platform/generate-custom-token.d.ts +2 -2
  88. package/dist/functions/google-identity-platform/generate-custom-token.js +3 -3
  89. package/dist/functions/google-identity-platform/generate-token.call.d.ts +1 -2
  90. package/dist/functions/google-identity-platform/generate-token.call.js +4 -4
  91. package/dist/functions/google-identity-platform/generate-token.d.ts +2 -2
  92. package/dist/functions/google-identity-platform/generate-token.js +3 -3
  93. package/dist/functions/google-pubsub/write-topics.d.ts +2 -3
  94. package/dist/functions/google-pubsub/write-topics.js +11 -12
  95. package/dist/functions/google-services/enable.call.d.ts +1 -2
  96. package/dist/functions/google-services/enable.call.js +3 -3
  97. package/dist/functions/google-services/enable.d.ts +2 -2
  98. package/dist/functions/google-services/enable.js +3 -3
  99. package/dist/functions/google-spanner/extract-database.d.ts +11 -0
  100. package/dist/functions/google-spanner/extract-database.js +25 -0
  101. package/dist/functions/google-spanner/index.d.ts +2 -0
  102. package/dist/functions/google-spanner/index.js +2 -0
  103. package/dist/functions/google-spanner/list-databases.d.ts +2 -2
  104. package/dist/functions/google-spanner/list-databases.js +7 -7
  105. package/dist/functions/google-spanner/query-records.call.d.ts +2 -0
  106. package/dist/functions/google-spanner/query-records.call.js +66 -0
  107. package/dist/functions/google-spanner/query-records.d.ts +22 -0
  108. package/dist/functions/google-spanner/query-records.js +27 -0
  109. package/dist/functions/google-spanner/write-databases.d.ts +2 -3
  110. package/dist/functions/google-spanner/write-databases.js +11 -12
  111. package/dist/functions/index.js +5 -4
  112. package/dist/functions/project/get-artefact-destination-cloud-functions.d.ts +2 -3
  113. package/dist/functions/project/get-artefact-destination-cloud-functions.js +5 -6
  114. package/dist/functions/project/get-artefact-destination-cloud-run.d.ts +2 -3
  115. package/dist/functions/project/get-artefact-destination-cloud-run.js +5 -6
  116. package/dist/functions/project/push-artefact-cloud-functions.call.d.ts +1 -2
  117. package/dist/functions/project/push-artefact-cloud-functions.call.js +5 -5
  118. package/dist/functions/project/push-artefact-cloud-functions.d.ts +2 -3
  119. package/dist/functions/project/push-artefact-cloud-functions.js +5 -5
  120. package/dist/functions/secret/fetch-access-token.call.d.ts +1 -2
  121. package/dist/functions/secret/fetch-access-token.call.js +4 -2
  122. package/dist/functions/secret/fetch-access-token.d.ts +2 -2
  123. package/dist/functions/secret/fetch-access-token.js +3 -3
  124. package/dist/functions/secret/fetch-secret-manager.call.d.ts +1 -2
  125. package/dist/functions/secret/fetch-secret-manager.call.js +3 -3
  126. package/dist/functions/secret/fetch-secret-manager.d.ts +2 -2
  127. package/dist/functions/secret/fetch-secret-manager.js +3 -3
  128. package/dist/functions/service-container/index.d.ts +1 -0
  129. package/dist/functions/service-container/index.js +1 -0
  130. package/dist/functions/service-container/query-logs-cloud-run.call.d.ts +3 -0
  131. package/dist/functions/service-container/query-logs-cloud-run.call.js +36 -0
  132. package/dist/functions/service-container/query-logs-cloud-run.d.ts +11 -0
  133. package/dist/functions/service-container/query-logs-cloud-run.js +18 -0
  134. package/dist/functions/typescript/get-decorator-renderer-google-firestore.d.ts +1 -2
  135. package/dist/functions/typescript/get-decorator-renderer-google-firestore.js +2 -3
  136. package/dist/functions/typescript/get-decorator-renderer-google-spanner.d.ts +1 -2
  137. package/dist/functions/typescript/get-decorator-renderer-google-spanner.js +2 -3
  138. package/dist/services/index.d.ts +1 -0
  139. package/dist/services/index.js +1 -0
  140. package/dist/services/logging.d.ts +16 -0
  141. package/dist/services/logging.js +20 -0
  142. package/package.json +22 -20
@@ -1,4 +1,4 @@
1
- import { callDeferred, WorkspaceContext } from '@causa/workspace';
1
+ import { callDeferred } from '@causa/workspace';
2
2
  import { EmulatorStart } from '@causa/workspace-core';
3
3
  import { SPANNER_EMULATOR_NAME } from '../../emulators/index.js';
4
4
  /**
@@ -6,8 +6,8 @@ import { SPANNER_EMULATOR_NAME } from '../../emulators/index.js';
6
6
  * This starts the emulator, creates a local instance, and creates the databases using the DDLs found in the workspace.
7
7
  */
8
8
  export class EmulatorStartForSpanner extends EmulatorStart {
9
- async _call(context) {
10
- return await callDeferred(this, context, import.meta.url);
9
+ async _call() {
10
+ return await callDeferred(this, import.meta.url);
11
11
  }
12
12
  _supports() {
13
13
  return this.name === undefined || this.name === SPANNER_EMULATOR_NAME;
@@ -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 Firebase Storage emulator.
5
4
  */
6
5
  export declare class EmulatorStopForFirebaseStorage extends EmulatorStop {
7
- _call(context: WorkspaceContext): Promise<string>;
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 { 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(context) {
10
- const containerName = getFirebaseStorageContainerName(context);
11
- context.logger.info('️🍱 Stopping Firebase Storage emulator.');
12
- await context.service(DockerEmulatorService).stop(containerName);
13
- context.logger.info('️🍱 Successfully stopped Firebase Storage emulator.');
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(context: WorkspaceContext): Promise<string>;
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(context) {
10
- const containerName = getFirestoreContainerName(context);
11
- context.logger.info('️🗃️ Stopping Firestore emulator.');
12
- await context.service(DockerEmulatorService).stop(containerName);
13
- context.logger.info('️🗃️ Successfully stopped Firestore emulator.');
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(context: WorkspaceContext): Promise<string>;
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(context) {
10
- const containerName = getIdentityPlatformContainerName(context);
11
- context.logger.info('️🛂 Stopping Identity Platform emulator.');
12
- await context.service(DockerEmulatorService).stop(containerName);
13
- context.logger.info('🛂 Successfully stopped Identity Platform emulator.');
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(context: WorkspaceContext): Promise<string>;
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(context) {
10
- const containerName = getPubSubContainerName(context);
11
- context.logger.info('️📫 Stopping Pub/Sub emulator.');
12
- await context.service(DockerEmulatorService).stop(containerName);
13
- context.logger.info('📫 Successfully stopped Pub/Sub emulator.');
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(context: WorkspaceContext): Promise<string>;
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(context) {
10
- const containerName = getSpannerContainerName(context);
11
- context.logger.info('️️🗃️ Stopping Spanner emulator.');
12
- await context.service(DockerEmulatorService).stop(containerName);
13
- context.logger.info('️🗃️ Successfully stopped Spanner emulator.');
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, context: WorkspaceContext): Promise<string>;
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(context) {
3
- const googleConf = context.asConfiguration();
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
- context.logger.info(`📫 Creating Pub/Sub topic '${topicId}'.`);
8
- await context.service(PubSubService).pubSub.createTopic({
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(context: WorkspaceContext): Promise<string>;
10
- _supports(context: WorkspaceContext): boolean;
8
+ _call(): Promise<string>;
9
+ _supports(): boolean;
11
10
  }
@@ -1,4 +1,4 @@
1
- import { callDeferred, WorkspaceContext } from '@causa/workspace';
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(context) {
10
- return await callDeferred(this, context, import.meta.url);
9
+ async _call() {
10
+ return await callDeferred(this, import.meta.url);
11
11
  }
12
- _supports(context) {
13
- return (context.asConfiguration().get('events.broker') ===
14
- 'google.pubSub');
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, context: WorkspaceContext): Promise<string[]>;
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(context) {
47
+ export default async function call() {
48
48
  const { serviceId, path } = typeof this.trigger === 'string'
49
- ? resolveFromString(context, this.trigger)
50
- : resolveFromObject(context, this.trigger);
51
- return await context
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(context: WorkspaceContext): Promise<string[]>;
19
- _supports(context: WorkspaceContext): boolean;
17
+ _call(): Promise<string[]>;
18
+ _supports(): boolean;
20
19
  }
@@ -1,4 +1,4 @@
1
- import { callDeferred, WorkspaceContext } from '@causa/workspace';
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(context) {
19
- return await callDeferred(this, context, import.meta.url);
18
+ async _call() {
19
+ return await callDeferred(this, import.meta.url);
20
20
  }
21
- _supports(context) {
22
- const isPubSub = context.asConfiguration().get('events.broker') ===
23
- 'google.pubSub';
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 = context.asConfiguration();
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, context: WorkspaceContext): Promise<void>;
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(context) {
4
- context.logger.info(`📫 Deleting Pub/Sub topic '${this.id}'.`);
3
+ export default async function call() {
4
+ this._context.logger.info(`📫 Deleting Pub/Sub topic '${this.id}'.`);
5
5
  try {
6
- await context.service(PubSubService).pubSub.topic(this.id).delete();
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
- context.logger.warn(`⚠️ Pub/Sub topic to delete '${this.id}' does not exist. It might have already been deleted.`);
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(context: WorkspaceContext): Promise<void>;
9
- _supports(context: WorkspaceContext): boolean;
7
+ _call(): Promise<void>;
8
+ _supports(): boolean;
10
9
  }
@@ -1,15 +1,16 @@
1
- import { callDeferred, WorkspaceContext } from '@causa/workspace';
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(context) {
9
- return await callDeferred(this, context, import.meta.url);
8
+ async _call() {
9
+ return await callDeferred(this, import.meta.url);
10
10
  }
11
- _supports(context) {
12
- return (context.asConfiguration().get('events.broker') ===
13
- 'google.pubSub');
11
+ _supports() {
12
+ return (this._context
13
+ .asConfiguration()
14
+ .get('events.broker') === 'google.pubSub');
14
15
  }
15
16
  }
@@ -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, context: WorkspaceContext): Promise<void>;
2
+ export default function call(this: EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole): Promise<void>;
@@ -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(context) {
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
- context.logger.info(`🛂 Removing invoker role on Cloud Run service '${serviceId}' for Pub/Sub service account '${pubSubServiceAccount}'.`);
13
- await context
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
  }
@@ -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(context: WorkspaceContext): Promise<void>;
10
- _supports(context: WorkspaceContext): boolean;
8
+ _call(): Promise<void>;
9
+ _supports(): boolean;
11
10
  }
@@ -1,4 +1,4 @@
1
- import { callDeferred, WorkspaceContext } from '@causa/workspace';
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(context) {
14
- return await callDeferred(this, context, import.meta.url);
13
+ async _call() {
14
+ return await callDeferred(this, import.meta.url);
15
15
  }
16
- _supports(context) {
16
+ _supports() {
17
17
  return (this.id.match(CLOUD_RUN_INVOKER_ID_REGEX) != null &&
18
- context.asConfiguration().get('events.broker') ===
19
- 'google.pubSub');
18
+ this._context
19
+ .asConfiguration()
20
+ .get('events.broker') === 'google.pubSub');
20
21
  }
21
22
  }
@@ -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, context: WorkspaceContext): Promise<void>;
2
+ export default function call(this: EventTopicBrokerDeleteTriggerResourceForPubSubSubscription): Promise<void>;
@@ -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(context) {
4
- context.logger.info(`📫 Deleting Pub/Sub subscription '${this.id}'.`);
3
+ export default async function call() {
4
+ this._context.logger.info(`📫 Deleting Pub/Sub subscription '${this.id}'.`);
5
5
  try {
6
- await context.service(PubSubService).pubSub.subscription(this.id).delete();
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
- context.logger.warn(`⚠️ Pub/Sub subscription '${this.id}' does not exist. It might have already been deleted.`);
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(context: WorkspaceContext): Promise<void>;
9
- _supports(context: WorkspaceContext): boolean;
7
+ _call(): Promise<void>;
8
+ _supports(): boolean;
10
9
  }
@@ -1,16 +1,17 @@
1
- import { callDeferred, WorkspaceContext } from '@causa/workspace';
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(context) {
9
- return await callDeferred(this, context, import.meta.url);
8
+ async _call() {
9
+ return await callDeferred(this, import.meta.url);
10
10
  }
11
- _supports(context) {
11
+ _supports() {
12
12
  return (this.id.match(/^projects\/[\w-]+\/subscriptions\/[\w-]+$/) != null &&
13
- context.asConfiguration().get('events.broker') ===
14
- 'google.pubSub');
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, context: WorkspaceContext): Promise<void>;
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(context) {
3
- context.logger.info(`🛂 Deleting Pub/Sub backfilling service account '${this.id}'.`);
2
+ export default async function call() {
3
+ this._context.logger.info(`🛂 Deleting Pub/Sub backfilling service account '${this.id}'.`);
4
4
  try {
5
- await context.service(IamService).deleteServiceAccount(this.id);
5
+ await this._context.service(IamService).deleteServiceAccount(this.id);
6
6
  }
7
7
  catch (error) {
8
8
  if (error.code === 404) {
9
- context.logger.warn(`⚠️ Pub/Sub backfilling service account '${this.id}' does not exist. It might have already been deleted.`);
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(context: WorkspaceContext): Promise<void>;
10
- _supports(context: WorkspaceContext): boolean;
8
+ _call(): Promise<void>;
9
+ _supports(): boolean;
11
10
  }
@@ -1,4 +1,4 @@
1
- import { callDeferred, WorkspaceContext } from '@causa/workspace';
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(context) {
10
- return await callDeferred(this, context, import.meta.url);
9
+ async _call() {
10
+ return await callDeferred(this, import.meta.url);
11
11
  }
12
- _supports(context) {
12
+ _supports() {
13
13
  return (this.id.match(/^projects\/[\w-]+\/serviceAccounts\/[^/]+$/) != null &&
14
- context.asConfiguration().get('events.broker') ===
15
- 'google.pubSub');
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(context: WorkspaceContext): Promise<string>;
9
- _supports(context: WorkspaceContext): boolean;
7
+ _call(): Promise<string>;
8
+ _supports(): boolean;
10
9
  }