@twin.org/engine-types 0.0.1-next.36 → 0.0.1-next.38
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/cjs/index.cjs +46 -1
- package/dist/esm/index.mjs +46 -1
- package/dist/types/models/config/entityStorageConnectorConfig.d.ts +21 -0
- package/dist/types/models/types/entityStorageConnectorType.d.ts +12 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/type-aliases/EntityStorageConnectorConfig.md +1 -1
- package/docs/reference/variables/EntityStorageConnectorType.md +18 -0
- package/package.json +5 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -11,6 +11,9 @@ var entityStorageConnectorDynamodb = require('@twin.org/entity-storage-connector
|
|
|
11
11
|
var entityStorageConnectorFile = require('@twin.org/entity-storage-connector-file');
|
|
12
12
|
var entityStorageConnectorGcpFirestore = require('@twin.org/entity-storage-connector-gcp-firestore');
|
|
13
13
|
var entityStorageConnectorMemory = require('@twin.org/entity-storage-connector-memory');
|
|
14
|
+
var entityStorageConnectorMongodb = require('@twin.org/entity-storage-connector-mongodb');
|
|
15
|
+
var entityStorageConnectorMysql = require('@twin.org/entity-storage-connector-mysql');
|
|
16
|
+
var entityStorageConnectorPostgresql = require('@twin.org/entity-storage-connector-postgresql');
|
|
14
17
|
var entityStorageConnectorScylladb = require('@twin.org/entity-storage-connector-scylladb');
|
|
15
18
|
var entityStorageModels = require('@twin.org/entity-storage-models');
|
|
16
19
|
var entityStorageService = require('@twin.org/entity-storage-service');
|
|
@@ -209,7 +212,19 @@ const EntityStorageConnectorType = {
|
|
|
209
212
|
/**
|
|
210
213
|
* GCP Firestore.
|
|
211
214
|
*/
|
|
212
|
-
GcpFirestoreDb: "gcp-firestoredb"
|
|
215
|
+
GcpFirestoreDb: "gcp-firestoredb",
|
|
216
|
+
/**
|
|
217
|
+
* MySqlDb.
|
|
218
|
+
*/
|
|
219
|
+
MySqlDb: "mysql",
|
|
220
|
+
/**
|
|
221
|
+
* MongoDb.
|
|
222
|
+
*/
|
|
223
|
+
MongoDb: "mongodb",
|
|
224
|
+
/**
|
|
225
|
+
* Postgre SQL.
|
|
226
|
+
*/
|
|
227
|
+
PostgreSql: "postgresql"
|
|
213
228
|
};
|
|
214
229
|
|
|
215
230
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -310,6 +325,36 @@ function initialiseEntityStorageConnector(engineCore, context, typeCustom, schem
|
|
|
310
325
|
}
|
|
311
326
|
});
|
|
312
327
|
}
|
|
328
|
+
else if (type === EntityStorageConnectorType.MySqlDb) {
|
|
329
|
+
entityStorageConnector = new entityStorageConnectorMysql.MySqlEntityStorageConnector({
|
|
330
|
+
entitySchema: schema,
|
|
331
|
+
...entityStorageConfig.options,
|
|
332
|
+
config: {
|
|
333
|
+
...entityStorageConfig.options.config,
|
|
334
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
else if (type === EntityStorageConnectorType.MongoDb) {
|
|
339
|
+
entityStorageConnector = new entityStorageConnectorMongodb.MongoDbEntityStorageConnector({
|
|
340
|
+
entitySchema: schema,
|
|
341
|
+
...entityStorageConfig.options,
|
|
342
|
+
config: {
|
|
343
|
+
...entityStorageConfig.options.config,
|
|
344
|
+
collection: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
else if (type === EntityStorageConnectorType.PostgreSql) {
|
|
349
|
+
entityStorageConnector = new entityStorageConnectorPostgresql.PostgreSqlEntityStorageConnector({
|
|
350
|
+
entitySchema: schema,
|
|
351
|
+
...entityStorageConfig.options,
|
|
352
|
+
config: {
|
|
353
|
+
...entityStorageConfig.options.config,
|
|
354
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
313
358
|
else {
|
|
314
359
|
throw new core.GeneralError("engineCore", "connectorUnknownType", {
|
|
315
360
|
type,
|
package/dist/esm/index.mjs
CHANGED
|
@@ -9,6 +9,9 @@ import { DynamoDbEntityStorageConnector } from '@twin.org/entity-storage-connect
|
|
|
9
9
|
import { FileEntityStorageConnector } from '@twin.org/entity-storage-connector-file';
|
|
10
10
|
import { FirestoreEntityStorageConnector } from '@twin.org/entity-storage-connector-gcp-firestore';
|
|
11
11
|
import { MemoryEntityStorageConnector } from '@twin.org/entity-storage-connector-memory';
|
|
12
|
+
import { MongoDbEntityStorageConnector } from '@twin.org/entity-storage-connector-mongodb';
|
|
13
|
+
import { MySqlEntityStorageConnector } from '@twin.org/entity-storage-connector-mysql';
|
|
14
|
+
import { PostgreSqlEntityStorageConnector } from '@twin.org/entity-storage-connector-postgresql';
|
|
12
15
|
import { ScyllaDBTableConnector } from '@twin.org/entity-storage-connector-scylladb';
|
|
13
16
|
import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
|
|
14
17
|
import { EntityStorageService } from '@twin.org/entity-storage-service';
|
|
@@ -207,7 +210,19 @@ const EntityStorageConnectorType = {
|
|
|
207
210
|
/**
|
|
208
211
|
* GCP Firestore.
|
|
209
212
|
*/
|
|
210
|
-
GcpFirestoreDb: "gcp-firestoredb"
|
|
213
|
+
GcpFirestoreDb: "gcp-firestoredb",
|
|
214
|
+
/**
|
|
215
|
+
* MySqlDb.
|
|
216
|
+
*/
|
|
217
|
+
MySqlDb: "mysql",
|
|
218
|
+
/**
|
|
219
|
+
* MongoDb.
|
|
220
|
+
*/
|
|
221
|
+
MongoDb: "mongodb",
|
|
222
|
+
/**
|
|
223
|
+
* Postgre SQL.
|
|
224
|
+
*/
|
|
225
|
+
PostgreSql: "postgresql"
|
|
211
226
|
};
|
|
212
227
|
|
|
213
228
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -308,6 +323,36 @@ function initialiseEntityStorageConnector(engineCore, context, typeCustom, schem
|
|
|
308
323
|
}
|
|
309
324
|
});
|
|
310
325
|
}
|
|
326
|
+
else if (type === EntityStorageConnectorType.MySqlDb) {
|
|
327
|
+
entityStorageConnector = new MySqlEntityStorageConnector({
|
|
328
|
+
entitySchema: schema,
|
|
329
|
+
...entityStorageConfig.options,
|
|
330
|
+
config: {
|
|
331
|
+
...entityStorageConfig.options.config,
|
|
332
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
else if (type === EntityStorageConnectorType.MongoDb) {
|
|
337
|
+
entityStorageConnector = new MongoDbEntityStorageConnector({
|
|
338
|
+
entitySchema: schema,
|
|
339
|
+
...entityStorageConfig.options,
|
|
340
|
+
config: {
|
|
341
|
+
...entityStorageConfig.options.config,
|
|
342
|
+
collection: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
else if (type === EntityStorageConnectorType.PostgreSql) {
|
|
347
|
+
entityStorageConnector = new PostgreSqlEntityStorageConnector({
|
|
348
|
+
entitySchema: schema,
|
|
349
|
+
...entityStorageConfig.options,
|
|
350
|
+
config: {
|
|
351
|
+
...entityStorageConfig.options.config,
|
|
352
|
+
tableName: `${entityStorageConfig.options.tablePrefix ?? ""}${instanceName}`
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
311
356
|
else {
|
|
312
357
|
throw new GeneralError("engineCore", "connectorUnknownType", {
|
|
313
358
|
type,
|
|
@@ -2,6 +2,9 @@ import type { ICosmosDbEntityStorageConnectorConstructorOptions } from "@twin.or
|
|
|
2
2
|
import type { IDynamoDbEntityStorageConnectorConstructorOptions } from "@twin.org/entity-storage-connector-dynamodb";
|
|
3
3
|
import type { IFileEntityStorageConnectorConstructorOptions } from "@twin.org/entity-storage-connector-file";
|
|
4
4
|
import type { IFirestoreEntityStorageConnectorConstructorOptions } from "@twin.org/entity-storage-connector-gcp-firestore";
|
|
5
|
+
import type { IMongoDbEntityStorageConnectorConstructorOptions } from "@twin.org/entity-storage-connector-mongodb";
|
|
6
|
+
import type { IMySqlEntityStorageConnectorConstructorOptions } from "@twin.org/entity-storage-connector-mysql";
|
|
7
|
+
import type { IPostgreSqlEntityStorageConnectorConstructorOptions } from "@twin.org/entity-storage-connector-postgresql";
|
|
5
8
|
import type { IScyllaDBTableConnectorConstructorOptions } from "@twin.org/entity-storage-connector-scylladb";
|
|
6
9
|
import type { EntityStorageConnectorType } from "../types/entityStorageConnectorType";
|
|
7
10
|
/**
|
|
@@ -39,4 +42,22 @@ export type EntityStorageConnectorConfig = {
|
|
|
39
42
|
config: Omit<IScyllaDBTableConnectorConstructorOptions["config"], "tableName">;
|
|
40
43
|
tablePrefix?: string;
|
|
41
44
|
};
|
|
45
|
+
} | {
|
|
46
|
+
type: typeof EntityStorageConnectorType.MySqlDb;
|
|
47
|
+
options: Omit<IMySqlEntityStorageConnectorConstructorOptions, "entitySchema" | "config"> & {
|
|
48
|
+
config: Omit<IMySqlEntityStorageConnectorConstructorOptions["config"], "tableName">;
|
|
49
|
+
tablePrefix?: string;
|
|
50
|
+
};
|
|
51
|
+
} | {
|
|
52
|
+
type: typeof EntityStorageConnectorType.MongoDb;
|
|
53
|
+
options: Omit<IMongoDbEntityStorageConnectorConstructorOptions, "entitySchema" | "config"> & {
|
|
54
|
+
config: Omit<IMongoDbEntityStorageConnectorConstructorOptions["config"], "collection">;
|
|
55
|
+
tablePrefix?: string;
|
|
56
|
+
};
|
|
57
|
+
} | {
|
|
58
|
+
type: typeof EntityStorageConnectorType.PostgreSql;
|
|
59
|
+
options: Omit<IPostgreSqlEntityStorageConnectorConstructorOptions, "entitySchema" | "config"> & {
|
|
60
|
+
config: Omit<IPostgreSqlEntityStorageConnectorConstructorOptions["config"], "tableName">;
|
|
61
|
+
tablePrefix?: string;
|
|
62
|
+
};
|
|
42
63
|
};
|
|
@@ -26,6 +26,18 @@ export declare const EntityStorageConnectorType: {
|
|
|
26
26
|
* GCP Firestore.
|
|
27
27
|
*/
|
|
28
28
|
readonly GcpFirestoreDb: "gcp-firestoredb";
|
|
29
|
+
/**
|
|
30
|
+
* MySqlDb.
|
|
31
|
+
*/
|
|
32
|
+
readonly MySqlDb: "mysql";
|
|
33
|
+
/**
|
|
34
|
+
* MongoDb.
|
|
35
|
+
*/
|
|
36
|
+
readonly MongoDb: "mongodb";
|
|
37
|
+
/**
|
|
38
|
+
* Postgre SQL.
|
|
39
|
+
*/
|
|
40
|
+
readonly PostgreSql: "postgresql";
|
|
29
41
|
};
|
|
30
42
|
/**
|
|
31
43
|
* Entity storage connector types.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: EntityStorageConnectorConfig
|
|
2
2
|
|
|
3
|
-
> **EntityStorageConnectorConfig**: \{ `type`: *typeof* [`File`](../variables/EntityStorageConnectorType.md#file); `options`: `Omit`\<`IFileEntityStorageConnectorConstructorOptions`, `"entitySchema"`\> & `object`; \} \| \{ `type`: *typeof* [`Memory`](../variables/EntityStorageConnectorType.md#memory); `options`: `never`; \} \| \{ `type`: *typeof* [`AwsDynamoDb`](../variables/EntityStorageConnectorType.md#awsdynamodb); `options`: `Omit`\<`IDynamoDbEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`AzureCosmosDb`](../variables/EntityStorageConnectorType.md#azurecosmosdb); `options`: `Omit`\<`ICosmosDbEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`GcpFirestoreDb`](../variables/EntityStorageConnectorType.md#gcpfirestoredb); `options`: `Omit`\<`IFirestoreEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`ScyllaDb`](../variables/EntityStorageConnectorType.md#scylladb); `options`: `Omit`\<`IScyllaDBTableConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \}
|
|
3
|
+
> **EntityStorageConnectorConfig**: \{ `type`: *typeof* [`File`](../variables/EntityStorageConnectorType.md#file); `options`: `Omit`\<`IFileEntityStorageConnectorConstructorOptions`, `"entitySchema"`\> & `object`; \} \| \{ `type`: *typeof* [`Memory`](../variables/EntityStorageConnectorType.md#memory); `options`: `never`; \} \| \{ `type`: *typeof* [`AwsDynamoDb`](../variables/EntityStorageConnectorType.md#awsdynamodb); `options`: `Omit`\<`IDynamoDbEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`AzureCosmosDb`](../variables/EntityStorageConnectorType.md#azurecosmosdb); `options`: `Omit`\<`ICosmosDbEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`GcpFirestoreDb`](../variables/EntityStorageConnectorType.md#gcpfirestoredb); `options`: `Omit`\<`IFirestoreEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`ScyllaDb`](../variables/EntityStorageConnectorType.md#scylladb); `options`: `Omit`\<`IScyllaDBTableConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`MySqlDb`](../variables/EntityStorageConnectorType.md#mysqldb); `options`: `Omit`\<`IMySqlEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`MongoDb`](../variables/EntityStorageConnectorType.md#mongodb); `options`: `Omit`\<`IMongoDbEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \} \| \{ `type`: *typeof* [`PostgreSql`](../variables/EntityStorageConnectorType.md#postgresql); `options`: `Omit`\<`IPostgreSqlEntityStorageConnectorConstructorOptions`, `"entitySchema"` \| `"config"`\> & `object`; \}
|
|
4
4
|
|
|
5
5
|
Entity storage connector config types.
|
|
@@ -41,3 +41,21 @@ Azure CosmosDB.
|
|
|
41
41
|
> `readonly` **GcpFirestoreDb**: `"gcp-firestoredb"` = `"gcp-firestoredb"`
|
|
42
42
|
|
|
43
43
|
GCP Firestore.
|
|
44
|
+
|
|
45
|
+
### MySqlDb
|
|
46
|
+
|
|
47
|
+
> `readonly` **MySqlDb**: `"mysql"` = `"mysql"`
|
|
48
|
+
|
|
49
|
+
MySqlDb.
|
|
50
|
+
|
|
51
|
+
### MongoDb
|
|
52
|
+
|
|
53
|
+
> `readonly` **MongoDb**: `"mongodb"` = `"mongodb"`
|
|
54
|
+
|
|
55
|
+
MongoDb.
|
|
56
|
+
|
|
57
|
+
### PostgreSql
|
|
58
|
+
|
|
59
|
+
> `readonly` **PostgreSql**: `"postgresql"` = `"postgresql"`
|
|
60
|
+
|
|
61
|
+
Postgre SQL.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-types",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.38",
|
|
4
4
|
"description": "Types to use in an engine.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@twin.org/crypto": "next",
|
|
19
19
|
"@twin.org/data-core": "next",
|
|
20
20
|
"@twin.org/data-schema-org": "next",
|
|
21
|
-
"@twin.org/engine-models": "0.0.1-next.
|
|
21
|
+
"@twin.org/engine-models": "0.0.1-next.38",
|
|
22
22
|
"@twin.org/entity": "next",
|
|
23
23
|
"@twin.org/modules": "next",
|
|
24
24
|
"@twin.org/nameof": "next"
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
"@twin.org/entity-storage-connector-file": "next",
|
|
47
47
|
"@twin.org/entity-storage-connector-gcp-firestore": "next",
|
|
48
48
|
"@twin.org/entity-storage-connector-memory": "next",
|
|
49
|
+
"@twin.org/entity-storage-connector-mongodb": "next",
|
|
50
|
+
"@twin.org/entity-storage-connector-mysql": "next",
|
|
51
|
+
"@twin.org/entity-storage-connector-postgresql": "next",
|
|
49
52
|
"@twin.org/entity-storage-connector-scylladb": "next",
|
|
50
53
|
"@twin.org/entity-storage-models": "next",
|
|
51
54
|
"@twin.org/entity-storage-service": "next",
|