@causa/workspace-google 0.12.2 → 0.13.0-rc.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.
Files changed (92) hide show
  1. package/dist/backfilling/bigquery.d.ts +1 -1
  2. package/dist/backfilling/pubsub.d.ts +1 -1
  3. package/dist/backfilling/pubsub.js +1 -1
  4. package/dist/code-generation/google-firestore-renderer.d.ts +1 -1
  5. package/dist/code-generation/google-firestore-renderer.js +7 -8
  6. package/dist/code-generation/google-spanner-renderer.d.ts +1 -1
  7. package/dist/code-generation/google-spanner-renderer.js +5 -6
  8. package/dist/code-generation/utils.d.ts +2 -2
  9. package/dist/code-generation/utils.js +1 -1
  10. package/dist/configurations/generated.d.ts +741 -0
  11. package/dist/configurations/generated.js +1347 -0
  12. package/dist/configurations/index.d.ts +1 -1
  13. package/dist/configurations/index.js +1 -0
  14. package/dist/configurations/schemas/google.yaml +466 -0
  15. package/dist/configurations/schemas/service-container-cloud-run.yaml +212 -0
  16. package/dist/functions/causa/index.d.ts +1 -0
  17. package/dist/functions/causa/index.js +1 -0
  18. package/dist/functions/causa/list-schemas.d.ts +9 -0
  19. package/dist/functions/causa/list-schemas.js +23 -0
  20. package/dist/functions/emulator/start-firebase-storage.js +1 -1
  21. package/dist/functions/emulator/start-firestore.js +1 -1
  22. package/dist/functions/emulator/start-identity-platform.js +1 -1
  23. package/dist/functions/emulator/start-pubsub.call.d.ts +4 -0
  24. package/dist/functions/emulator/start-pubsub.call.js +57 -0
  25. package/dist/functions/emulator/start-pubsub.d.ts +0 -22
  26. package/dist/functions/emulator/start-pubsub.js +4 -75
  27. package/dist/functions/emulator/start-spanner.call.d.ts +4 -0
  28. package/dist/functions/emulator/start-spanner.call.js +92 -0
  29. package/dist/functions/emulator/start-spanner.d.ts +0 -38
  30. package/dist/functions/emulator/start-spanner.js +4 -124
  31. package/dist/functions/emulator/stop-firebase-storage.js +2 -1
  32. package/dist/functions/emulator/stop-firestore.js +2 -1
  33. package/dist/functions/emulator/stop-identity-platform.js +2 -1
  34. package/dist/functions/emulator/stop-pubsub.js +2 -1
  35. package/dist/functions/emulator/stop-spanner.js +2 -1
  36. package/dist/functions/event-topic/broker-create-topic-pubsub.call.d.ts +3 -0
  37. package/dist/functions/event-topic/broker-create-topic-pubsub.call.js +15 -0
  38. package/dist/functions/event-topic/broker-create-topic-pubsub.js +2 -14
  39. package/dist/functions/event-topic/broker-create-trigger-cloud-run.call.d.ts +3 -0
  40. package/dist/functions/event-topic/broker-create-trigger-cloud-run.call.js +24 -0
  41. package/dist/functions/event-topic/broker-create-trigger-cloud-run.js +2 -19
  42. package/dist/functions/event-topic/broker-delete-topic-pubsub.call.d.ts +3 -0
  43. package/dist/functions/event-topic/broker-delete-topic-pubsub.call.js +15 -0
  44. package/dist/functions/event-topic/broker-delete-topic-pubsub.js +2 -14
  45. package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.d.ts +3 -0
  46. package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.call.js +16 -0
  47. package/dist/functions/event-topic/broker-delete-trigger-resource-cloud-run-invoker-role.js +2 -11
  48. package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.d.ts +3 -0
  49. package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.call.js +16 -0
  50. package/dist/functions/event-topic/broker-delete-trigger-resource-pubsub-subscription.js +2 -18
  51. package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.call.d.ts +3 -0
  52. package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.call.js +15 -0
  53. package/dist/functions/event-topic/broker-delete-trigger-resource-service-account.js +2 -14
  54. package/dist/functions/event-topic/broker-publish-events-google.call.d.ts +3 -0
  55. package/dist/functions/event-topic/broker-publish-events-google.call.js +29 -0
  56. package/dist/functions/event-topic/broker-publish-events-google.d.ts +0 -7
  57. package/dist/functions/event-topic/broker-publish-events-google.js +3 -34
  58. package/dist/functions/google-app-check/generate-token.call.d.ts +3 -0
  59. package/dist/functions/google-app-check/generate-token.call.js +17 -0
  60. package/dist/functions/google-app-check/generate-token.js +2 -16
  61. package/dist/functions/google-identity-platform/generate-custom-token.call.d.ts +3 -0
  62. package/dist/functions/google-identity-platform/generate-custom-token.call.js +8 -0
  63. package/dist/functions/google-identity-platform/generate-custom-token.js +2 -7
  64. package/dist/functions/google-identity-platform/generate-token.call.d.ts +3 -0
  65. package/dist/functions/google-identity-platform/generate-token.call.js +13 -0
  66. package/dist/functions/google-identity-platform/generate-token.js +2 -12
  67. package/dist/functions/google-services/enable.call.d.ts +7 -0
  68. package/dist/functions/google-services/enable.call.js +35 -0
  69. package/dist/functions/google-services/enable.js +2 -34
  70. package/dist/functions/index.js +2 -1
  71. package/dist/functions/project/push-artefact-cloud-functions.call.d.ts +3 -0
  72. package/dist/functions/project/push-artefact-cloud-functions.call.js +19 -0
  73. package/dist/functions/project/push-artefact-cloud-functions.js +3 -18
  74. package/dist/functions/secret/fetch-access-token.call.d.ts +3 -0
  75. package/dist/functions/secret/fetch-access-token.call.js +10 -0
  76. package/dist/functions/secret/fetch-access-token.js +2 -8
  77. package/dist/functions/secret/fetch-secret-manager.call.d.ts +3 -0
  78. package/dist/functions/secret/fetch-secret-manager.call.js +32 -0
  79. package/dist/functions/secret/fetch-secret-manager.js +2 -29
  80. package/dist/functions/typescript/get-decorator-renderer-google-firestore.d.ts +3 -3
  81. package/dist/functions/typescript/get-decorator-renderer-google-firestore.js +4 -4
  82. package/dist/functions/typescript/get-decorator-renderer-google-spanner.d.ts +3 -3
  83. package/dist/functions/typescript/get-decorator-renderer-google-spanner.js +4 -4
  84. package/dist/index.d.ts +1 -2
  85. package/dist/index.js +1 -2
  86. package/dist/services/firebase-emulator.d.ts +1 -1
  87. package/dist/services/firebase-emulator.js +1 -1
  88. package/dist/services/gcloud-emulator.d.ts +1 -1
  89. package/dist/services/gcloud-emulator.js +1 -1
  90. package/package.json +14 -11
  91. package/dist/configurations/google.d.ts +0 -305
  92. package/dist/configurations/google.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { WorkspaceContext } from '@causa/workspace';
2
- import type { BackfillEvent, BackfillEventsSource } from '@causa/workspace-core';
2
+ import type { BackfillEvent, BackfillEventsSource } from '@causa/workspace-core/backfill';
3
3
  /**
4
4
  * An events source that reads events from a BigQuery table.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { WorkspaceContext } from '@causa/workspace';
2
- import { type BackfillEvent, BackfillEventPublisher } from '@causa/workspace-core';
2
+ import { type BackfillEvent, BackfillEventPublisher } from '@causa/workspace-core/backfill';
3
3
  /**
4
4
  * A publisher that publishes events to backfill to a Pub/Sub topic.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { WorkspaceContext } from '@causa/workspace';
2
- import { BackfillEventPublisher, } from '@causa/workspace-core';
2
+ import { BackfillEventPublisher, } from '@causa/workspace-core/backfill';
3
3
  import { FlowControlledPublisher } from '@google-cloud/pubsub/build/src/publisher/flow-publisher.js';
4
4
  import { PubSubService } from '../services/index.js';
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { type ClassContext, type TypeScriptDecorator, TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript';
1
+ import { type ClassContext, type TypeScriptDecorator, TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
2
2
  /**
3
3
  * A {@link TypeScriptDecoratorsRenderer} that adds Google Firestore decorators from the Causa Google runtime.
4
4
  *
@@ -1,5 +1,4 @@
1
- import { TypeScriptWithDecoratorsRenderer, } from '@causa/workspace-typescript';
2
- import { Name, panic } from 'quicktype-core';
1
+ import { TypeScriptWithDecoratorsRenderer, } from '@causa/workspace-typescript/code-generation';
3
2
  import { schemaMatchesGlobPatterns } from './utils.js';
4
3
  /**
5
4
  * The name of the Causa attribute that should be present for a class to be decorated with Google Firestore decorators.
@@ -26,14 +25,14 @@ export class GoogleFirestoreRenderer extends TypeScriptWithDecoratorsRenderer {
26
25
  }
27
26
  const debugName = context.classType.getCombinedName();
28
27
  if (typeof collectionAttribute !== 'object') {
29
- panic(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object.`);
28
+ throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object.`);
30
29
  }
31
30
  const { name, path, hasSoftDelete } = collectionAttribute;
32
31
  if (typeof name !== 'string') {
33
- panic(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object with a 'name' string property.`);
32
+ throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object with a 'name' string property.`);
34
33
  }
35
34
  if (!Array.isArray(path)) {
36
- panic(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object with a 'path' array property.`);
35
+ throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object with a 'path' array property.`);
37
36
  }
38
37
  const requiredProperties = path.flatMap((e) => typeof e === 'object' &&
39
38
  e !== null &&
@@ -49,7 +48,7 @@ export class GoogleFirestoreRenderer extends TypeScriptWithDecoratorsRenderer {
49
48
  });
50
49
  for (const propertyName of requiredProperties) {
51
50
  if (!propertyReferences.has(propertyName)) {
52
- panic(`Property '${propertyName}' referenced in 'path' not found in '${debugName}'.`);
51
+ throw new Error(`Property '${propertyName}' referenced in 'path' not found in '${debugName}'.`);
53
52
  }
54
53
  }
55
54
  const elements = path.map((element) => {
@@ -62,11 +61,11 @@ export class GoogleFirestoreRenderer extends TypeScriptWithDecoratorsRenderer {
62
61
  const propertyName = element.property;
63
62
  const generatedName = propertyReferences.get(propertyName);
64
63
  if (!generatedName) {
65
- panic(`Property '${propertyName}' not found in property references.`);
64
+ throw new Error(`Property '${propertyName}' not found in property references.`);
66
65
  }
67
66
  return ['doc.', generatedName];
68
67
  }
69
- panic(`Invalid path element in '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'.`);
68
+ throw new Error(`Invalid path element in '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'.`);
70
69
  });
71
70
  const pathExpression = path.length === 1
72
71
  ? elements
@@ -1,4 +1,4 @@
1
- import { type ClassContext, type ClassPropertyContext, type TypeScriptDecorator, TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript';
1
+ import { type ClassContext, type ClassPropertyContext, type TypeScriptDecorator, TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
2
2
  /**
3
3
  * A {@link TypeScriptDecoratorsRenderer} that adds Google Spanner decorators from the Causa Google runtime.
4
4
  *
@@ -1,5 +1,4 @@
1
- import { TypeScriptWithDecoratorsRenderer, getSingleType, typeScriptSourceForObject, } from '@causa/workspace-typescript';
2
- import { panic } from 'quicktype-core';
1
+ import { TypeScriptWithDecoratorsRenderer, getSingleType, typeScriptSourceForObject, } from '@causa/workspace-typescript/code-generation';
3
2
  import { schemaMatchesGlobPatterns } from './utils.js';
4
3
  /**
5
4
  * The name of the Causa attribute that should be present for a class to be decorated with Google Spanner decorators.
@@ -42,10 +41,10 @@ export class GoogleSpannerRenderer extends TypeScriptWithDecoratorsRenderer {
42
41
  !Array.isArray(tableAttribute.primaryKey) ||
43
42
  tableAttribute.primaryKey.length === 0 ||
44
43
  tableAttribute.primaryKey.some((k) => typeof k !== 'string')) {
45
- panic(`Invalid '${GOOGLE_SPANNER_TABLE_ATTRIBUTE}' attribute on '${context.classType.getCombinedName()}'. Expected an object with a 'primaryKey' array.`);
44
+ throw new Error(`Invalid '${GOOGLE_SPANNER_TABLE_ATTRIBUTE}' attribute on '${context.classType.getCombinedName()}'. Expected an object with a 'primaryKey' array.`);
46
45
  }
47
46
  if ('name' in tableAttribute && typeof tableAttribute.name !== 'string') {
48
- panic(`Invalid 'name' in '${GOOGLE_SPANNER_TABLE_ATTRIBUTE}' attribute on '${context.classType.getCombinedName()}'. Expected a string.`);
47
+ throw new Error(`Invalid 'name' in '${GOOGLE_SPANNER_TABLE_ATTRIBUTE}' attribute on '${context.classType.getCombinedName()}'. Expected a string.`);
49
48
  }
50
49
  const optionsSource = typeScriptSourceForObject({
51
50
  primaryKey: tableAttribute.primaryKey,
@@ -66,12 +65,12 @@ export class GoogleSpannerRenderer extends TypeScriptWithDecoratorsRenderer {
66
65
  const softDeletionColumn = generatorOptions?.google?.spanner?.softDeletionColumn;
67
66
  const { name: overriddenName, tsOptions } = attributes;
68
67
  if (tsOptions && typeof tsOptions !== 'object') {
69
- panic(`Invalid 'tsOptions' in '${GOOGLE_SPANNER_COLUMN_ATTRIBUTE}' attribute. Expected an object.`);
68
+ throw new Error(`Invalid 'tsOptions' in '${GOOGLE_SPANNER_COLUMN_ATTRIBUTE}' attribute. Expected an object.`);
70
69
  }
71
70
  const columnAttributes = tsOptions ?? {};
72
71
  if (overriddenName) {
73
72
  if (typeof overriddenName !== 'string') {
74
- panic(`Invalid 'name' in '${GOOGLE_SPANNER_COLUMN_ATTRIBUTE}' attribute. Expected a string.`);
73
+ throw new Error(`Invalid 'name' in '${GOOGLE_SPANNER_COLUMN_ATTRIBUTE}' attribute. Expected a string.`);
75
74
  }
76
75
  columnAttributes.name = overriddenName;
77
76
  }
@@ -1,5 +1,5 @@
1
- import type { ClassContext } from '@causa/workspace-typescript';
2
- import { TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript';
1
+ import type { ClassContext } from '@causa/workspace-typescript/code-generation';
2
+ import { TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
3
3
  /**
4
4
  * Checks whether the schema matches the glob patterns specified in the renderer's options.
5
5
  * If this returns `false`, the decorators should not be generated for the schema.
@@ -1,4 +1,4 @@
1
- import { TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript';
1
+ import { TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
2
2
  import micromatch from 'micromatch';
3
3
  import { join } from 'path';
4
4
  /**