@causa/workspace-google 0.18.0-beta.1 → 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/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 +1 -0
- package/dist/functions/google-firestore/index.js +1 -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 +1 -0
- package/dist/functions/google-spanner/index.js +1 -0
- package/dist/functions/index.js +3 -4
- package/package.json +6 -7
- 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 -8
- package/dist/functions/typescript/get-decorator-renderer-google-firestore.js +0 -14
- package/dist/functions/typescript/get-decorator-renderer-google-spanner.d.ts +0 -8
- package/dist/functions/typescript/get-decorator-renderer-google-spanner.js +0 -14
- package/dist/functions/typescript/index.d.ts +0 -2
- package/dist/functions/typescript/index.js +0 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModelGenerateTypeScriptDecorators } from '@causa/workspace-typescript';
|
|
2
|
+
import { type TypeScriptDecorator } from '@causa/workspace-typescript/code-generation';
|
|
3
|
+
/**
|
|
4
|
+
* Implements {@link ModelGenerateTypeScriptDecorators} to add Google Firestore decorators from the Causa Google runtime.
|
|
5
|
+
*
|
|
6
|
+
* If an object schema is marked with the `googleFirestoreCollection` extension, the `@FirestoreCollection` decorator is
|
|
7
|
+
* added to the class. If the `hasSoftDelete` property is `true`, the `@SoftDeletedFirestoreCollection` decorator is also
|
|
8
|
+
* added.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ModelGenerateTypeScriptDecoratorsForGoogleFirestore extends ModelGenerateTypeScriptDecorators {
|
|
11
|
+
_call(): TypeScriptDecorator[];
|
|
12
|
+
_supports(): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ModelGenerateTypeScriptDecorators } from '@causa/workspace-typescript';
|
|
2
|
+
import { addDecoratorToList, } from '@causa/workspace-typescript/code-generation';
|
|
3
|
+
import micromatch from 'micromatch';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
/**
|
|
6
|
+
* The name of the Causa extension marking an object schema as a Google Firestore collection.
|
|
7
|
+
*/
|
|
8
|
+
const GOOGLE_FIRESTORE_COLLECTION_EXTENSION = 'googleFirestoreCollection';
|
|
9
|
+
/**
|
|
10
|
+
* The name of the Causa module for the TypeScript Google runtime.
|
|
11
|
+
*/
|
|
12
|
+
const CAUSA_GOOGLE_MODULE = '@causa/runtime-google';
|
|
13
|
+
/**
|
|
14
|
+
* Implements {@link ModelGenerateTypeScriptDecorators} to add Google Firestore decorators from the Causa Google runtime.
|
|
15
|
+
*
|
|
16
|
+
* If an object schema is marked with the `googleFirestoreCollection` extension, the `@FirestoreCollection` decorator is
|
|
17
|
+
* added to the class. If the `hasSoftDelete` property is `true`, the `@SoftDeletedFirestoreCollection` decorator is also
|
|
18
|
+
* added.
|
|
19
|
+
*/
|
|
20
|
+
export class ModelGenerateTypeScriptDecoratorsForGoogleFirestore extends ModelGenerateTypeScriptDecorators {
|
|
21
|
+
_call() {
|
|
22
|
+
if (this.property) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
const attribute = this.schema.extensions[GOOGLE_FIRESTORE_COLLECTION_EXTENSION];
|
|
26
|
+
if (!attribute) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
const globs = this.configuration?.google?.firestore?.globs;
|
|
30
|
+
if (Array.isArray(globs)) {
|
|
31
|
+
const projectPath = this._context.getProjectPathOrThrow();
|
|
32
|
+
const absoluteGlobs = globs.map((g) => join(projectPath, g));
|
|
33
|
+
const schemaPath = this.schema.path.split('#')[0];
|
|
34
|
+
if (!micromatch.isMatch(schemaPath, absoluteGlobs)) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const debugName = this.schema.name;
|
|
39
|
+
if (typeof attribute !== 'object') {
|
|
40
|
+
throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_EXTENSION}' attribute on '${debugName}'. Expected an object.`);
|
|
41
|
+
}
|
|
42
|
+
const { name, path, hasSoftDelete } = attribute;
|
|
43
|
+
if (typeof name !== 'string') {
|
|
44
|
+
throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_EXTENSION}' attribute on '${debugName}'. Expected an object with a 'name' string property.`);
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(path)) {
|
|
47
|
+
throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_EXTENSION}' attribute on '${debugName}'. Expected an object with a 'path' array property.`);
|
|
48
|
+
}
|
|
49
|
+
const propertyNames = new Set(this.schema.properties.map((p) => p.name));
|
|
50
|
+
const elements = path.map((element) => {
|
|
51
|
+
if (typeof element === 'string') {
|
|
52
|
+
return JSON.stringify(element);
|
|
53
|
+
}
|
|
54
|
+
if (typeof element === 'object' &&
|
|
55
|
+
element !== null &&
|
|
56
|
+
'property' in element &&
|
|
57
|
+
typeof element.property === 'string') {
|
|
58
|
+
const propertyName = element.property;
|
|
59
|
+
if (!propertyNames.has(propertyName)) {
|
|
60
|
+
throw new Error(`Property '${propertyName}' referenced in 'path' not found in '${debugName}'.`);
|
|
61
|
+
}
|
|
62
|
+
return `doc.${propertyName}`;
|
|
63
|
+
}
|
|
64
|
+
throw new Error(`Invalid path element in '${GOOGLE_FIRESTORE_COLLECTION_EXTENSION}' attribute on '${debugName}'.`);
|
|
65
|
+
});
|
|
66
|
+
const pathExpression = path.length === 1 ? elements[0] : `[${elements.join(', ')}].join("/")`;
|
|
67
|
+
const decorators = [];
|
|
68
|
+
addDecoratorToList(decorators, { schema: this.schema }, 'FirestoreCollection', CAUSA_GOOGLE_MODULE, `@FirestoreCollection({ name: ${JSON.stringify(name)}, path: (doc) => ${pathExpression} })`);
|
|
69
|
+
if (hasSoftDelete === true) {
|
|
70
|
+
addDecoratorToList(decorators, { schema: this.schema }, 'SoftDeletedFirestoreCollection', CAUSA_GOOGLE_MODULE, '@SoftDeletedFirestoreCollection()');
|
|
71
|
+
}
|
|
72
|
+
return decorators;
|
|
73
|
+
}
|
|
74
|
+
_supports() {
|
|
75
|
+
return (this._context.get('project.language') === 'typescript' &&
|
|
76
|
+
this.generator === 'typescriptModelClass');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ModelSchemaExtractDatabaseForGoogleFirestore } from './extract-database.js';
|
|
2
|
+
export { ModelGenerateTypeScriptDecoratorsForGoogleFirestore } from './generate-typescript-decorators.js';
|
|
2
3
|
export { DatabaseQueryRecordsForFirestore } from './query-records.js';
|
|
3
4
|
export { GoogleFirestoreMergeRules } from './merge-rules.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ModelSchemaExtractDatabaseForGoogleFirestore } from './extract-database.js';
|
|
2
|
+
export { ModelGenerateTypeScriptDecoratorsForGoogleFirestore } from './generate-typescript-decorators.js';
|
|
2
3
|
export { DatabaseQueryRecordsForFirestore } from './query-records.js';
|
|
3
4
|
export { GoogleFirestoreMergeRules } from './merge-rules.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ModelGenerateTypeScriptDecorators } from '@causa/workspace-typescript';
|
|
2
|
+
import { type TypeScriptDecorator } from '@causa/workspace-typescript/code-generation';
|
|
3
|
+
/**
|
|
4
|
+
* Implements {@link ModelGenerateTypeScriptDecorators} to add Google Spanner decorators from the Causa Google runtime.
|
|
5
|
+
*
|
|
6
|
+
* If an object schema is marked with the `googleSpannerTable` extension, the `@SpannerTable` decorator is added to the
|
|
7
|
+
* class, and `@SpannerColumn` decorators are added to all its properties.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ModelGenerateTypeScriptDecoratorsForGoogleSpanner extends ModelGenerateTypeScriptDecorators {
|
|
10
|
+
_call(): TypeScriptDecorator[];
|
|
11
|
+
_supports(): boolean;
|
|
12
|
+
private decoratorsForClass;
|
|
13
|
+
private decoratorsForProperty;
|
|
14
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ModelGenerateTypeScriptDecorators } from '@causa/workspace-typescript';
|
|
2
|
+
import { addDecoratorToList, } from '@causa/workspace-typescript/code-generation';
|
|
3
|
+
import micromatch from 'micromatch';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
/**
|
|
6
|
+
* The name of the Causa extension marking an object schema as a Google Spanner table.
|
|
7
|
+
*/
|
|
8
|
+
const GOOGLE_SPANNER_TABLE_EXTENSION = 'googleSpannerTable';
|
|
9
|
+
/**
|
|
10
|
+
* The name of the optional Causa extension that can be present on an object property schema to specify options for the
|
|
11
|
+
* `@SpannerColumn` decorator.
|
|
12
|
+
*/
|
|
13
|
+
const GOOGLE_SPANNER_COLUMN_EXTENSION = 'googleSpannerColumn';
|
|
14
|
+
/**
|
|
15
|
+
* The name of the Causa module for the TypeScript Google runtime.
|
|
16
|
+
*/
|
|
17
|
+
const CAUSA_GOOGLE_MODULE = '@causa/runtime-google';
|
|
18
|
+
/**
|
|
19
|
+
* The list of options that can be passed to the `@SpannerColumn` decorator and that indicates that the schema specifies
|
|
20
|
+
* the type of the column. In this case, the renderer should not infer any type information.
|
|
21
|
+
*/
|
|
22
|
+
const TYPE_INFO_COLUMN_ATTRIBUTE_NAMES = [
|
|
23
|
+
'isBigInt',
|
|
24
|
+
'isInt',
|
|
25
|
+
'isPreciseDate',
|
|
26
|
+
'isJson',
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Implements {@link ModelGenerateTypeScriptDecorators} to add Google Spanner decorators from the Causa Google runtime.
|
|
30
|
+
*
|
|
31
|
+
* If an object schema is marked with the `googleSpannerTable` extension, the `@SpannerTable` decorator is added to the
|
|
32
|
+
* class, and `@SpannerColumn` decorators are added to all its properties.
|
|
33
|
+
*/
|
|
34
|
+
export class ModelGenerateTypeScriptDecoratorsForGoogleSpanner extends ModelGenerateTypeScriptDecorators {
|
|
35
|
+
_call() {
|
|
36
|
+
const tableAttribute = this.schema.extensions[GOOGLE_SPANNER_TABLE_EXTENSION];
|
|
37
|
+
if (!tableAttribute) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const globs = this.configuration?.google?.spanner?.globs;
|
|
41
|
+
if (Array.isArray(globs)) {
|
|
42
|
+
const projectPath = this._context.getProjectPathOrThrow();
|
|
43
|
+
const absoluteGlobs = globs.map((g) => join(projectPath, g));
|
|
44
|
+
const schemaPath = this.schema.path.split('#')[0];
|
|
45
|
+
if (!micromatch.isMatch(schemaPath, absoluteGlobs)) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return this.property
|
|
50
|
+
? this.decoratorsForProperty()
|
|
51
|
+
: this.decoratorsForClass(tableAttribute);
|
|
52
|
+
}
|
|
53
|
+
_supports() {
|
|
54
|
+
return (this._context.get('project.language') === 'typescript' &&
|
|
55
|
+
this.generator === 'typescriptModelClass');
|
|
56
|
+
}
|
|
57
|
+
decoratorsForClass(tableAttribute) {
|
|
58
|
+
const debugName = this.schema.name;
|
|
59
|
+
if (typeof tableAttribute !== 'object' ||
|
|
60
|
+
tableAttribute === null ||
|
|
61
|
+
!('primaryKey' in tableAttribute) ||
|
|
62
|
+
!Array.isArray(tableAttribute.primaryKey) ||
|
|
63
|
+
tableAttribute.primaryKey.length === 0 ||
|
|
64
|
+
tableAttribute.primaryKey.some((k) => typeof k !== 'string')) {
|
|
65
|
+
throw new Error(`Invalid '${GOOGLE_SPANNER_TABLE_EXTENSION}' attribute on '${debugName}'. Expected an object with a 'primaryKey' array.`);
|
|
66
|
+
}
|
|
67
|
+
const { primaryKey, name } = tableAttribute;
|
|
68
|
+
if (name !== undefined && typeof name !== 'string') {
|
|
69
|
+
throw new Error(`Invalid 'name' in '${GOOGLE_SPANNER_TABLE_EXTENSION}' attribute on '${debugName}'. Expected a string.`);
|
|
70
|
+
}
|
|
71
|
+
const decorators = [];
|
|
72
|
+
addDecoratorToList(decorators, { schema: this.schema }, 'SpannerTable', CAUSA_GOOGLE_MODULE, `@SpannerTable(${JSON.stringify({ primaryKey, name })})`);
|
|
73
|
+
return decorators;
|
|
74
|
+
}
|
|
75
|
+
decoratorsForProperty() {
|
|
76
|
+
const property = this.property;
|
|
77
|
+
const rawAttributes = property.extensions[GOOGLE_SPANNER_COLUMN_EXTENSION] ?? {};
|
|
78
|
+
if (typeof rawAttributes !== 'object' || rawAttributes === null) {
|
|
79
|
+
throw new Error(`Invalid '${GOOGLE_SPANNER_COLUMN_EXTENSION}' attribute on '${this.schema.name}.${property.name}'. Expected an object.`);
|
|
80
|
+
}
|
|
81
|
+
const { name: overriddenName, tsOptions } = rawAttributes;
|
|
82
|
+
if (tsOptions !== undefined &&
|
|
83
|
+
(typeof tsOptions !== 'object' || tsOptions === null)) {
|
|
84
|
+
throw new Error(`Invalid 'tsOptions' in '${GOOGLE_SPANNER_COLUMN_EXTENSION}' attribute. Expected an object.`);
|
|
85
|
+
}
|
|
86
|
+
const columnAttributes = {
|
|
87
|
+
...(tsOptions ?? {}),
|
|
88
|
+
};
|
|
89
|
+
if (overriddenName !== undefined) {
|
|
90
|
+
if (typeof overriddenName !== 'string') {
|
|
91
|
+
throw new Error(`Invalid 'name' in '${GOOGLE_SPANNER_COLUMN_EXTENSION}' attribute. Expected a string.`);
|
|
92
|
+
}
|
|
93
|
+
columnAttributes.name = overriddenName;
|
|
94
|
+
}
|
|
95
|
+
const softDeletionColumn = this.configuration?.google?.spanner
|
|
96
|
+
?.softDeletionColumn;
|
|
97
|
+
const columnName = typeof overriddenName === 'string' ? overriddenName : property.name;
|
|
98
|
+
if (columnName === softDeletionColumn) {
|
|
99
|
+
columnAttributes.softDelete = true;
|
|
100
|
+
}
|
|
101
|
+
const schemaOverridesTypeInfo = TYPE_INFO_COLUMN_ATTRIBUTE_NAMES.some((n) => n in columnAttributes);
|
|
102
|
+
if (!schemaOverridesTypeInfo) {
|
|
103
|
+
const type = property.type.kind === 'array' ? property.type.items : property.type;
|
|
104
|
+
const resolved = type.kind === 'ref' ? this.schemas[type.ref] : undefined;
|
|
105
|
+
if (type.kind === 'primitive' && type.type === 'integer') {
|
|
106
|
+
columnAttributes.isInt = true;
|
|
107
|
+
}
|
|
108
|
+
else if (type.kind === 'map' || resolved?.kind === 'object') {
|
|
109
|
+
columnAttributes.isJson = true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const hasOptions = Object.keys(columnAttributes).length > 0;
|
|
113
|
+
const source = hasOptions
|
|
114
|
+
? `@SpannerColumn(${JSON.stringify(columnAttributes)})`
|
|
115
|
+
: '@SpannerColumn()';
|
|
116
|
+
const decorators = [];
|
|
117
|
+
addDecoratorToList(decorators, { schema: this.schema, property }, 'SpannerColumn', CAUSA_GOOGLE_MODULE, source);
|
|
118
|
+
return decorators;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ModelSchemaExtractDatabaseForGoogleSpanner } from './extract-database.js';
|
|
2
|
+
export { ModelGenerateTypeScriptDecoratorsForGoogleSpanner } from './generate-typescript-decorators.js';
|
|
2
3
|
export { GoogleSpannerListDatabases } from './list-databases.js';
|
|
3
4
|
export { DatabaseQueryRecordsForSpanner } from './query-records.js';
|
|
4
5
|
export { GoogleSpannerWriteDatabases } from './write-databases.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ModelSchemaExtractDatabaseForGoogleSpanner } from './extract-database.js';
|
|
2
|
+
export { ModelGenerateTypeScriptDecoratorsForGoogleSpanner } from './generate-typescript-decorators.js';
|
|
2
3
|
export { GoogleSpannerListDatabases } from './list-databases.js';
|
|
3
4
|
export { DatabaseQueryRecordsForSpanner } from './query-records.js';
|
|
4
5
|
export { GoogleSpannerWriteDatabases } from './write-databases.js';
|
package/dist/functions/index.js
CHANGED
|
@@ -3,15 +3,14 @@ import { EmulatorStartForFirebaseStorage, EmulatorStartForFirestore, EmulatorSta
|
|
|
3
3
|
import { EventTopicBrokerCreateTopicForPubSub, EventTopicBrokerCreateTriggerForCloudRun, EventTopicBrokerDeleteTopicForPubSub, EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole, EventTopicBrokerDeleteTriggerResourceForPubSubSubscription, EventTopicBrokerDeleteTriggerResourceForServiceAccount, EventTopicBrokerGetTopicIdForPubSub, EventTopicBrokerPublishEventsForGoogle, EventTopicCreateBackfillSourceForBigQuery, EventTopicQueryEventsForBigQuery, } from './event-topic/index.js';
|
|
4
4
|
import { GoogleAppCheckGenerateToken } from './google-app-check/index.js';
|
|
5
5
|
import { GoogleFirebaseStorageMergeRules } from './google-firebase-storage/index.js';
|
|
6
|
-
import { DatabaseQueryRecordsForFirestore, GoogleFirestoreMergeRules, ModelSchemaExtractDatabaseForGoogleFirestore, } from './google-firestore/index.js';
|
|
6
|
+
import { DatabaseQueryRecordsForFirestore, GoogleFirestoreMergeRules, ModelGenerateTypeScriptDecoratorsForGoogleFirestore, ModelSchemaExtractDatabaseForGoogleFirestore, } from './google-firestore/index.js';
|
|
7
7
|
import { GoogleIdentityPlatformGenerateCustomToken, GoogleIdentityPlatformGenerateToken, } from './google-identity-platform/index.js';
|
|
8
8
|
import { GooglePubSubWriteTopics } from './google-pubsub/index.js';
|
|
9
9
|
import { GoogleServicesEnable } from './google-services/index.js';
|
|
10
|
-
import { DatabaseQueryRecordsForSpanner, GoogleSpannerListDatabases, GoogleSpannerWriteDatabases, ModelSchemaExtractDatabaseForGoogleSpanner, } from './google-spanner/index.js';
|
|
10
|
+
import { DatabaseQueryRecordsForSpanner, GoogleSpannerListDatabases, GoogleSpannerWriteDatabases, ModelGenerateTypeScriptDecoratorsForGoogleSpanner, ModelSchemaExtractDatabaseForGoogleSpanner, } from './google-spanner/index.js';
|
|
11
11
|
import { ProjectGetArtefactDestinationForCloudFunctions, ProjectGetArtefactDestinationForCloudRun, ProjectPushArtefactForCloudFunctions, } from './project/index.js';
|
|
12
12
|
import { SecretFetchForGoogleAccessToken, SecretFetchForGoogleSecretManager, } from './secret/index.js';
|
|
13
13
|
import { ServiceContainerQueryLogsForCloudRun } from './service-container/index.js';
|
|
14
|
-
import { TypeScriptGetDecoratorRendererForGoogleFirestore, TypeScriptGetDecoratorRendererForGoogleSpanner, } from './typescript/index.js';
|
|
15
14
|
export function registerFunctions(context) {
|
|
16
|
-
context.registerFunctionImplementations(CausaListConfigurationSchemasForGoogle, DatabaseQueryRecordsForFirestore, DatabaseQueryRecordsForSpanner, EmulatorStartForFirebaseStorage, EmulatorStartForFirestore, EmulatorStartForIdentityPlatform, EmulatorStartForPubSub, EmulatorStartForSpanner, EmulatorStopForFirebaseStorage, EmulatorStopForFirestore, EmulatorStopForIdentityPlatform, EmulatorStopForPubSub, EmulatorStopForSpanner, EventTopicBrokerCreateTopicForPubSub, EventTopicBrokerCreateTriggerForCloudRun, EventTopicBrokerDeleteTopicForPubSub, EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole, EventTopicBrokerDeleteTriggerResourceForPubSubSubscription, EventTopicBrokerDeleteTriggerResourceForServiceAccount, EventTopicBrokerGetTopicIdForPubSub, EventTopicBrokerPublishEventsForGoogle, EventTopicCreateBackfillSourceForBigQuery, EventTopicQueryEventsForBigQuery, GoogleAppCheckGenerateToken, GoogleFirebaseStorageMergeRules, GoogleFirestoreMergeRules, GoogleIdentityPlatformGenerateCustomToken, GoogleIdentityPlatformGenerateToken, GooglePubSubWriteTopics, GoogleServicesEnable, GoogleSpannerListDatabases, GoogleSpannerWriteDatabases, ModelSchemaExtractDatabaseForGoogleFirestore, ModelSchemaExtractDatabaseForGoogleSpanner, ProjectGetArtefactDestinationForCloudFunctions, ProjectGetArtefactDestinationForCloudRun, ProjectPushArtefactForCloudFunctions, SecretFetchForGoogleAccessToken, SecretFetchForGoogleSecretManager, ServiceContainerQueryLogsForCloudRun
|
|
15
|
+
context.registerFunctionImplementations(CausaListConfigurationSchemasForGoogle, DatabaseQueryRecordsForFirestore, DatabaseQueryRecordsForSpanner, EmulatorStartForFirebaseStorage, EmulatorStartForFirestore, EmulatorStartForIdentityPlatform, EmulatorStartForPubSub, EmulatorStartForSpanner, EmulatorStopForFirebaseStorage, EmulatorStopForFirestore, EmulatorStopForIdentityPlatform, EmulatorStopForPubSub, EmulatorStopForSpanner, EventTopicBrokerCreateTopicForPubSub, EventTopicBrokerCreateTriggerForCloudRun, EventTopicBrokerDeleteTopicForPubSub, EventTopicBrokerDeleteTriggerResourceForCloudRunInvokerRole, EventTopicBrokerDeleteTriggerResourceForPubSubSubscription, EventTopicBrokerDeleteTriggerResourceForServiceAccount, EventTopicBrokerGetTopicIdForPubSub, EventTopicBrokerPublishEventsForGoogle, EventTopicCreateBackfillSourceForBigQuery, EventTopicQueryEventsForBigQuery, GoogleAppCheckGenerateToken, GoogleFirebaseStorageMergeRules, GoogleFirestoreMergeRules, GoogleIdentityPlatformGenerateCustomToken, GoogleIdentityPlatformGenerateToken, GooglePubSubWriteTopics, GoogleServicesEnable, GoogleSpannerListDatabases, GoogleSpannerWriteDatabases, ModelGenerateTypeScriptDecoratorsForGoogleFirestore, ModelGenerateTypeScriptDecoratorsForGoogleSpanner, ModelSchemaExtractDatabaseForGoogleFirestore, ModelSchemaExtractDatabaseForGoogleSpanner, ProjectGetArtefactDestinationForCloudFunctions, ProjectGetArtefactDestinationForCloudRun, ProjectPushArtefactForCloudFunctions, SecretFetchForGoogleAccessToken, SecretFetchForGoogleSecretManager, ServiceContainerQueryLogsForCloudRun);
|
|
17
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@causa/workspace-google",
|
|
3
|
-
"version": "0.18.0-beta.
|
|
3
|
+
"version": "0.18.0-beta.2",
|
|
4
4
|
"description": "The Causa workspace module providing many functionalities related to GCP and its services.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@causa/cli": ">= 0.8.0-beta.1 < 1.0.0",
|
|
39
39
|
"@causa/workspace": ">= 0.25.0-beta.3 < 1.0.0",
|
|
40
|
-
"@causa/workspace-core": ">= 0.35.0-beta.
|
|
41
|
-
"@causa/workspace-typescript": ">= 0.23.0-beta.
|
|
40
|
+
"@causa/workspace-core": ">= 0.35.0-beta.2 < 1.0.0",
|
|
41
|
+
"@causa/workspace-typescript": ">= 0.23.0-beta.2 < 1.0.0",
|
|
42
42
|
"@google-cloud/apikeys": "^2.2.2",
|
|
43
43
|
"@google-cloud/bigquery": "^8.3.1",
|
|
44
44
|
"@google-cloud/iam-credentials": "^4.2.2",
|
|
@@ -56,10 +56,9 @@
|
|
|
56
56
|
"globby": "^16.2.0",
|
|
57
57
|
"google-auth-library": "^10.6.2",
|
|
58
58
|
"google-gax": "5.0.6",
|
|
59
|
-
"googleapis": "^
|
|
59
|
+
"googleapis": "^172.0.0",
|
|
60
60
|
"micromatch": "^4.0.8",
|
|
61
|
-
"pino": "^10.3.1"
|
|
62
|
-
"quicktype-core": "^23.2.6"
|
|
61
|
+
"pino": "^10.3.1"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
64
|
"@swc/core": "^1.15.33",
|
|
@@ -76,7 +75,7 @@
|
|
|
76
75
|
"jest-extended": "^7.0.0",
|
|
77
76
|
"rimraf": "^6.1.3",
|
|
78
77
|
"typescript": "^6.0.3",
|
|
79
|
-
"typescript-eslint": "^8.59.
|
|
78
|
+
"typescript-eslint": "^8.59.4",
|
|
80
79
|
"yaml": "^2.9.0"
|
|
81
80
|
}
|
|
82
81
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ClassContext, type TypeScriptDecorator, TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
|
|
2
|
-
/**
|
|
3
|
-
* A {@link TypeScriptDecoratorsRenderer} that adds Google Firestore decorators from the Causa Google runtime.
|
|
4
|
-
*
|
|
5
|
-
* If an object schema is marked with the `googleFirestoreCollection` attribute, the `@FirestoreCollection` decorator
|
|
6
|
-
* is added to the class. If the `hasSoftDelete` property is `true`, the `@SoftDeletedFirestoreCollection` decorator
|
|
7
|
-
* is also added.
|
|
8
|
-
*/
|
|
9
|
-
export declare class GoogleFirestoreRenderer extends TypeScriptWithDecoratorsRenderer {
|
|
10
|
-
decoratorsForClass(context: ClassContext): TypeScriptDecorator[];
|
|
11
|
-
decoratorsForProperty(): TypeScriptDecorator[];
|
|
12
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { TypeScriptWithDecoratorsRenderer, } from '@causa/workspace-typescript/code-generation';
|
|
2
|
-
import { schemaMatchesGlobPatterns } from './utils.js';
|
|
3
|
-
/**
|
|
4
|
-
* The name of the Causa attribute that should be present for a class to be decorated with Google Firestore decorators.
|
|
5
|
-
*/
|
|
6
|
-
const GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE = 'googleFirestoreCollection';
|
|
7
|
-
/**
|
|
8
|
-
* The name of the Causa module for the TypeScript Google runtime.
|
|
9
|
-
*/
|
|
10
|
-
const CAUSA_GOOGLE_MODULE = '@causa/runtime-google';
|
|
11
|
-
/**
|
|
12
|
-
* A {@link TypeScriptDecoratorsRenderer} that adds Google Firestore decorators from the Causa Google runtime.
|
|
13
|
-
*
|
|
14
|
-
* If an object schema is marked with the `googleFirestoreCollection` attribute, the `@FirestoreCollection` decorator
|
|
15
|
-
* is added to the class. If the `hasSoftDelete` property is `true`, the `@SoftDeletedFirestoreCollection` decorator
|
|
16
|
-
* is also added.
|
|
17
|
-
*/
|
|
18
|
-
export class GoogleFirestoreRenderer extends TypeScriptWithDecoratorsRenderer {
|
|
19
|
-
decoratorsForClass(context) {
|
|
20
|
-
const collectionAttribute = context.objectAttributes[GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE];
|
|
21
|
-
const globs = this.targetLanguage.options.generatorOptions?.google?.firestore?.globs;
|
|
22
|
-
if (!collectionAttribute ||
|
|
23
|
-
!schemaMatchesGlobPatterns(this, context, globs)) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
const debugName = context.classType.getCombinedName();
|
|
27
|
-
if (typeof collectionAttribute !== 'object') {
|
|
28
|
-
throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object.`);
|
|
29
|
-
}
|
|
30
|
-
const { name, path, hasSoftDelete } = collectionAttribute;
|
|
31
|
-
if (typeof name !== 'string') {
|
|
32
|
-
throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object with a 'name' string property.`);
|
|
33
|
-
}
|
|
34
|
-
if (!Array.isArray(path)) {
|
|
35
|
-
throw new Error(`Invalid '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'. Expected an object with a 'path' array property.`);
|
|
36
|
-
}
|
|
37
|
-
const requiredProperties = path.flatMap((e) => typeof e === 'object' &&
|
|
38
|
-
e !== null &&
|
|
39
|
-
'property' in e &&
|
|
40
|
-
typeof e.property === 'string'
|
|
41
|
-
? [e.property]
|
|
42
|
-
: []);
|
|
43
|
-
const propertyReferences = new Map();
|
|
44
|
-
this.forEachClassProperty(context.classType, 'none', (name, jsonName) => {
|
|
45
|
-
if (requiredProperties.includes(jsonName)) {
|
|
46
|
-
propertyReferences.set(jsonName, name);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
for (const propertyName of requiredProperties) {
|
|
50
|
-
if (!propertyReferences.has(propertyName)) {
|
|
51
|
-
throw new Error(`Property '${propertyName}' referenced in 'path' not found in '${debugName}'.`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const elements = path.map((element) => {
|
|
55
|
-
if (typeof element === 'string') {
|
|
56
|
-
return JSON.stringify(element);
|
|
57
|
-
}
|
|
58
|
-
if (typeof element === 'object' &&
|
|
59
|
-
element !== null &&
|
|
60
|
-
'property' in element) {
|
|
61
|
-
const propertyName = element.property;
|
|
62
|
-
const generatedName = propertyReferences.get(propertyName);
|
|
63
|
-
if (!generatedName) {
|
|
64
|
-
throw new Error(`Property '${propertyName}' not found in property references.`);
|
|
65
|
-
}
|
|
66
|
-
return ['doc.', generatedName];
|
|
67
|
-
}
|
|
68
|
-
throw new Error(`Invalid path element in '${GOOGLE_FIRESTORE_COLLECTION_ATTRIBUTE}' attribute on '${debugName}'.`);
|
|
69
|
-
});
|
|
70
|
-
const pathExpression = path.length === 1
|
|
71
|
-
? elements
|
|
72
|
-
: ['[', ...elements.flatMap((e) => [e, ', ']), "].join('/')"];
|
|
73
|
-
const decorators = [];
|
|
74
|
-
this.addDecoratorToList(decorators, context, 'FirestoreCollection', CAUSA_GOOGLE_MODULE, [
|
|
75
|
-
'@FirestoreCollection({ name: ',
|
|
76
|
-
JSON.stringify(name),
|
|
77
|
-
', path: (doc) => ',
|
|
78
|
-
...pathExpression,
|
|
79
|
-
'})',
|
|
80
|
-
]);
|
|
81
|
-
if (hasSoftDelete === true) {
|
|
82
|
-
this.addDecoratorToList(decorators, context, 'SoftDeletedFirestoreCollection', CAUSA_GOOGLE_MODULE, ['@SoftDeletedFirestoreCollection()']);
|
|
83
|
-
}
|
|
84
|
-
return decorators;
|
|
85
|
-
}
|
|
86
|
-
decoratorsForProperty() {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ClassContext, type ClassPropertyContext, type TypeScriptDecorator, TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
|
|
2
|
-
/**
|
|
3
|
-
* A {@link TypeScriptDecoratorsRenderer} that adds Google Spanner decorators from the Causa Google runtime.
|
|
4
|
-
*
|
|
5
|
-
* If an object schema is marked with the `googleSpannerTable` attribute, the `@SpannerTable` decorator is added to the
|
|
6
|
-
* class, and `@SpannerColumn` decorators are added to all its properties.
|
|
7
|
-
*/
|
|
8
|
-
export declare class GoogleSpannerRenderer extends TypeScriptWithDecoratorsRenderer {
|
|
9
|
-
decoratorsForClass(context: ClassContext): TypeScriptDecorator[];
|
|
10
|
-
decoratorsForProperty(context: ClassPropertyContext): TypeScriptDecorator[];
|
|
11
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { TypeScriptWithDecoratorsRenderer, getSingleType, typeScriptSourceForObject, } from '@causa/workspace-typescript/code-generation';
|
|
2
|
-
import { schemaMatchesGlobPatterns } from './utils.js';
|
|
3
|
-
/**
|
|
4
|
-
* The name of the Causa attribute that should be present for a class to be decorated with Google Spanner decorators.
|
|
5
|
-
*/
|
|
6
|
-
const GOOGLE_SPANNER_TABLE_ATTRIBUTE = 'googleSpannerTable';
|
|
7
|
-
/**
|
|
8
|
-
* The name of the optional Causa attribute that can be present on an object property schema to specify options for the
|
|
9
|
-
* `@SpannerColumn` decorator.
|
|
10
|
-
*/
|
|
11
|
-
const GOOGLE_SPANNER_COLUMN_ATTRIBUTE = 'googleSpannerColumn';
|
|
12
|
-
/**
|
|
13
|
-
* The name of the Causa module for the TypeScript Google runtime.
|
|
14
|
-
*/
|
|
15
|
-
const CAUSA_GOOGLE_MODULE = '@causa/runtime-google';
|
|
16
|
-
/**
|
|
17
|
-
* The list of options that can be passed to the `@SpannerColumn` decorator and that indicates that the JSONSchema
|
|
18
|
-
* specifies the type of the column. In this case, the renderer should not infer any type information.
|
|
19
|
-
*/
|
|
20
|
-
const TYPE_INFO_COLUMN_ATTRIBUTE_NAMES = [
|
|
21
|
-
'isBigInt',
|
|
22
|
-
'isInt',
|
|
23
|
-
'isPreciseDate',
|
|
24
|
-
'isJson',
|
|
25
|
-
];
|
|
26
|
-
/**
|
|
27
|
-
* A {@link TypeScriptDecoratorsRenderer} that adds Google Spanner decorators from the Causa Google runtime.
|
|
28
|
-
*
|
|
29
|
-
* If an object schema is marked with the `googleSpannerTable` attribute, the `@SpannerTable` decorator is added to the
|
|
30
|
-
* class, and `@SpannerColumn` decorators are added to all its properties.
|
|
31
|
-
*/
|
|
32
|
-
export class GoogleSpannerRenderer extends TypeScriptWithDecoratorsRenderer {
|
|
33
|
-
decoratorsForClass(context) {
|
|
34
|
-
const tableAttribute = context.objectAttributes[GOOGLE_SPANNER_TABLE_ATTRIBUTE];
|
|
35
|
-
const globs = this.targetLanguage.options.generatorOptions?.google?.spanner?.globs;
|
|
36
|
-
if (!tableAttribute || !schemaMatchesGlobPatterns(this, context, globs)) {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
if (typeof tableAttribute !== 'object' ||
|
|
40
|
-
!('primaryKey' in tableAttribute) ||
|
|
41
|
-
!Array.isArray(tableAttribute.primaryKey) ||
|
|
42
|
-
tableAttribute.primaryKey.length === 0 ||
|
|
43
|
-
tableAttribute.primaryKey.some((k) => typeof k !== 'string')) {
|
|
44
|
-
throw new Error(`Invalid '${GOOGLE_SPANNER_TABLE_ATTRIBUTE}' attribute on '${context.classType.getCombinedName()}'. Expected an object with a 'primaryKey' array.`);
|
|
45
|
-
}
|
|
46
|
-
if ('name' in tableAttribute && typeof tableAttribute.name !== 'string') {
|
|
47
|
-
throw new Error(`Invalid 'name' in '${GOOGLE_SPANNER_TABLE_ATTRIBUTE}' attribute on '${context.classType.getCombinedName()}'. Expected a string.`);
|
|
48
|
-
}
|
|
49
|
-
const optionsSource = typeScriptSourceForObject({
|
|
50
|
-
primaryKey: tableAttribute.primaryKey,
|
|
51
|
-
name: tableAttribute.name,
|
|
52
|
-
});
|
|
53
|
-
const decorators = [];
|
|
54
|
-
this.addDecoratorToList(decorators, context, 'SpannerTable', CAUSA_GOOGLE_MODULE, ['@SpannerTable(', optionsSource, ')']);
|
|
55
|
-
return decorators;
|
|
56
|
-
}
|
|
57
|
-
decoratorsForProperty(context) {
|
|
58
|
-
const globs = this.targetLanguage.options.generatorOptions?.google?.spanner?.globs;
|
|
59
|
-
if (!context.objectAttributes[GOOGLE_SPANNER_TABLE_ATTRIBUTE] ||
|
|
60
|
-
!schemaMatchesGlobPatterns(this, context, globs)) {
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
const attributes = context.propertyAttributes[GOOGLE_SPANNER_COLUMN_ATTRIBUTE] ?? {};
|
|
64
|
-
const { generatorOptions } = this.targetLanguage.options;
|
|
65
|
-
const softDeletionColumn = generatorOptions?.google?.spanner?.softDeletionColumn;
|
|
66
|
-
const { name: overriddenName, tsOptions } = attributes;
|
|
67
|
-
if (tsOptions && typeof tsOptions !== 'object') {
|
|
68
|
-
throw new Error(`Invalid 'tsOptions' in '${GOOGLE_SPANNER_COLUMN_ATTRIBUTE}' attribute. Expected an object.`);
|
|
69
|
-
}
|
|
70
|
-
const columnAttributes = tsOptions ?? {};
|
|
71
|
-
if (overriddenName) {
|
|
72
|
-
if (typeof overriddenName !== 'string') {
|
|
73
|
-
throw new Error(`Invalid 'name' in '${GOOGLE_SPANNER_COLUMN_ATTRIBUTE}' attribute. Expected a string.`);
|
|
74
|
-
}
|
|
75
|
-
columnAttributes.name = overriddenName;
|
|
76
|
-
}
|
|
77
|
-
const columnName = overriddenName ?? this.names.get(context.name);
|
|
78
|
-
if (columnName === softDeletionColumn) {
|
|
79
|
-
columnAttributes.softDelete = true;
|
|
80
|
-
}
|
|
81
|
-
const singleTypeInfo = getSingleType(context.property.type);
|
|
82
|
-
const schemaOverridesTypeInfo = TYPE_INFO_COLUMN_ATTRIBUTE_NAMES.some((name) => name in columnAttributes);
|
|
83
|
-
if (!schemaOverridesTypeInfo && singleTypeInfo) {
|
|
84
|
-
switch (singleTypeInfo.type?.kind) {
|
|
85
|
-
case 'class':
|
|
86
|
-
case 'object':
|
|
87
|
-
case 'map':
|
|
88
|
-
columnAttributes.isJson = true;
|
|
89
|
-
break;
|
|
90
|
-
case 'integer':
|
|
91
|
-
columnAttributes.isInt = true;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const optionsSource = typeScriptSourceForObject(columnAttributes);
|
|
96
|
-
const decorators = [];
|
|
97
|
-
this.addDecoratorToList(decorators, context, 'SpannerColumn', CAUSA_GOOGLE_MODULE, ['@SpannerColumn(', optionsSource, ')']);
|
|
98
|
-
return decorators;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ClassContext } from '@causa/workspace-typescript/code-generation';
|
|
2
|
-
import { TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether the schema matches the glob patterns specified in the renderer's options.
|
|
5
|
-
* If this returns `false`, the decorators should not be generated for the schema.
|
|
6
|
-
*
|
|
7
|
-
* @param renderer The renderer instance.
|
|
8
|
-
* @param context The {@link ClassContext} of the schema to check.
|
|
9
|
-
* @param globs The glob patterns to match against, or undefined/null if not configured.
|
|
10
|
-
* @returns `true` if the decorators should be generated for the schema.
|
|
11
|
-
*/
|
|
12
|
-
export declare function schemaMatchesGlobPatterns(renderer: TypeScriptWithDecoratorsRenderer, context: ClassContext, globs: unknown): boolean;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { TypeScriptWithDecoratorsRenderer } from '@causa/workspace-typescript/code-generation';
|
|
2
|
-
import micromatch from 'micromatch';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
/**
|
|
5
|
-
* Checks whether the schema matches the glob patterns specified in the renderer's options.
|
|
6
|
-
* If this returns `false`, the decorators should not be generated for the schema.
|
|
7
|
-
*
|
|
8
|
-
* @param renderer The renderer instance.
|
|
9
|
-
* @param context The {@link ClassContext} of the schema to check.
|
|
10
|
-
* @param globs The glob patterns to match against, or undefined/null if not configured.
|
|
11
|
-
* @returns `true` if the decorators should be generated for the schema.
|
|
12
|
-
*/
|
|
13
|
-
export function schemaMatchesGlobPatterns(renderer, context, globs) {
|
|
14
|
-
const { uri } = context;
|
|
15
|
-
if (!uri || !globs || !Array.isArray(globs)) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
const projectPath = renderer.targetLanguage.workspaceContext.getProjectPathOrThrow();
|
|
19
|
-
const absoluteGlobs = globs.map((g) => join(projectPath, g));
|
|
20
|
-
return micromatch.isMatch(uri, absoluteGlobs);
|
|
21
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TypeScriptGetDecoratorRenderer, type TypeScriptWithDecoratorsRendererType } from '@causa/workspace-typescript';
|
|
2
|
-
/**
|
|
3
|
-
* Implements {@link TypeScriptGetDecoratorRenderer} for the `GoogleFirestoreRenderer`.
|
|
4
|
-
*/
|
|
5
|
-
export declare class TypeScriptGetDecoratorRendererForGoogleFirestore extends TypeScriptGetDecoratorRenderer {
|
|
6
|
-
_call(): Promise<TypeScriptWithDecoratorsRendererType>;
|
|
7
|
-
_supports(): boolean;
|
|
8
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TypeScriptGetDecoratorRenderer, } from '@causa/workspace-typescript';
|
|
2
|
-
/**
|
|
3
|
-
* Implements {@link TypeScriptGetDecoratorRenderer} for the `GoogleFirestoreRenderer`.
|
|
4
|
-
*/
|
|
5
|
-
export class TypeScriptGetDecoratorRendererForGoogleFirestore extends TypeScriptGetDecoratorRenderer {
|
|
6
|
-
async _call() {
|
|
7
|
-
const { GoogleFirestoreRenderer } = await import('../../code-generation/index.js');
|
|
8
|
-
return GoogleFirestoreRenderer;
|
|
9
|
-
}
|
|
10
|
-
_supports() {
|
|
11
|
-
return (this._context.get('project.language') === 'typescript' &&
|
|
12
|
-
this.generator === 'typescriptModelClass');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TypeScriptGetDecoratorRenderer, type TypeScriptWithDecoratorsRendererType } from '@causa/workspace-typescript';
|
|
2
|
-
/**
|
|
3
|
-
* Implements {@link TypeScriptGetDecoratorRenderer} for the `GoogleSpannerRenderer`.
|
|
4
|
-
*/
|
|
5
|
-
export declare class TypeScriptGetDecoratorRendererForGoogleSpanner extends TypeScriptGetDecoratorRenderer {
|
|
6
|
-
_call(): Promise<TypeScriptWithDecoratorsRendererType>;
|
|
7
|
-
_supports(): boolean;
|
|
8
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TypeScriptGetDecoratorRenderer, } from '@causa/workspace-typescript';
|
|
2
|
-
/**
|
|
3
|
-
* Implements {@link TypeScriptGetDecoratorRenderer} for the `GoogleSpannerRenderer`.
|
|
4
|
-
*/
|
|
5
|
-
export class TypeScriptGetDecoratorRendererForGoogleSpanner extends TypeScriptGetDecoratorRenderer {
|
|
6
|
-
async _call() {
|
|
7
|
-
const { GoogleSpannerRenderer } = await import('../../code-generation/index.js');
|
|
8
|
-
return GoogleSpannerRenderer;
|
|
9
|
-
}
|
|
10
|
-
_supports() {
|
|
11
|
-
return (this._context.get('project.language') === 'typescript' &&
|
|
12
|
-
this.generator === 'typescriptModelClass');
|
|
13
|
-
}
|
|
14
|
-
}
|