@etohq/index 1.0.0
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/README.md +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders/index.d.ts +4 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +27 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/migrations/Migration20231019174230.d.ts +5 -0
- package/dist/migrations/Migration20231019174230.d.ts.map +1 -0
- package/dist/migrations/Migration20231019174230.js +16 -0
- package/dist/migrations/Migration20231019174230.js.map +1 -0
- package/dist/migrations/Migration20241209173313.d.ts +6 -0
- package/dist/migrations/Migration20241209173313.d.ts.map +1 -0
- package/dist/migrations/Migration20241209173313.js +36 -0
- package/dist/migrations/Migration20241209173313.js.map +1 -0
- package/dist/models/index-data.d.ts +9 -0
- package/dist/models/index-data.d.ts.map +1 -0
- package/dist/models/index-data.js +39 -0
- package/dist/models/index-data.js.map +1 -0
- package/dist/models/index-relation.d.ts +22 -0
- package/dist/models/index-relation.d.ts.map +1 -0
- package/dist/models/index-relation.js +21 -0
- package/dist/models/index-relation.js.map +1 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +11 -0
- package/dist/models/index.js.map +1 -0
- package/dist/services/index-module-service.d.ts +30 -0
- package/dist/services/index-module-service.d.ts.map +1 -0
- package/dist/services/index-module-service.js +71 -0
- package/dist/services/index-module-service.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +9 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/postgres-provider.d.ts +132 -0
- package/dist/services/postgres-provider.d.ts.map +1 -0
- package/dist/services/postgres-provider.js +490 -0
- package/dist/services/postgres-provider.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/build-config.d.ts +24 -0
- package/dist/utils/build-config.d.ts.map +1 -0
- package/dist/utils/build-config.js +472 -0
- package/dist/utils/build-config.js.map +1 -0
- package/dist/utils/create-partitions.d.ts +4 -0
- package/dist/utils/create-partitions.d.ts.map +1 -0
- package/dist/utils/create-partitions.js +31 -0
- package/dist/utils/create-partitions.js.map +1 -0
- package/dist/utils/default-schema.d.ts +2 -0
- package/dist/utils/default-schema.d.ts.map +1 -0
- package/dist/utils/default-schema.js +24 -0
- package/dist/utils/default-schema.js.map +1 -0
- package/dist/utils/flatten-object-keys.d.ts +23 -0
- package/dist/utils/flatten-object-keys.d.ts.map +1 -0
- package/dist/utils/flatten-object-keys.js +54 -0
- package/dist/utils/flatten-object-keys.js.map +1 -0
- package/dist/utils/gql-to-types.d.ts +2 -0
- package/dist/utils/gql-to-types.d.ts.map +1 -0
- package/dist/utils/gql-to-types.js +91 -0
- package/dist/utils/gql-to-types.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/normalize-fields-selection.d.ts +2 -0
- package/dist/utils/normalize-fields-selection.d.ts.map +1 -0
- package/dist/utils/normalize-fields-selection.js +10 -0
- package/dist/utils/normalize-fields-selection.js.map +1 -0
- package/dist/utils/query-builder.d.ts +42 -0
- package/dist/utils/query-builder.d.ts.map +1 -0
- package/dist/utils/query-builder.js +420 -0
- package/dist/utils/query-builder.js.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Index Module
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;;;;AAI9C,wBAGE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const _services_1 = require("./services");
|
|
7
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
8
|
+
const index_1 = __importDefault(require("./loaders/index"));
|
|
9
|
+
exports.default = (0, utils_1.Module)(utils_1.Modules.INDEX, {
|
|
10
|
+
service: _services_1.IndexModuleService,
|
|
11
|
+
loaders: [index_1.default],
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAA8C;AAC9C,kDAAwD;AACxD,4DAA6C;AAE7C,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,KAAK,EAAE;IACnC,OAAO,EAAE,8BAAkB;IAC3B,OAAO,EAAE,CAAC,eAAe,CAAC;CAC3B,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;iDAER,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;AAA3E,wBAsBC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const awilix_1 = require("awilix");
|
|
4
|
+
const postgres_provider_1 = require("../services/postgres-provider");
|
|
5
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
6
|
+
const _services_1 = require("../services");
|
|
7
|
+
exports.default = async ({ container, options }) => {
|
|
8
|
+
container.register({
|
|
9
|
+
baseRepository: (0, awilix_1.asClass)(utils_1.MikroOrmBaseRepository).singleton(),
|
|
10
|
+
searchModuleService: (0, awilix_1.asClass)(_services_1.IndexModuleService).singleton(),
|
|
11
|
+
});
|
|
12
|
+
container.register("storageProviderCtrOptions", (0, awilix_1.asValue)(undefined));
|
|
13
|
+
container.register("storageProviderCtr", (0, awilix_1.asValue)(postgres_provider_1.PostgresProvider));
|
|
14
|
+
/*if (!options?.customAdapter) {
|
|
15
|
+
container.register("storageProviderCtr", asValue(PostgresProvider))
|
|
16
|
+
} else {
|
|
17
|
+
container.register(
|
|
18
|
+
"storageProviderCtr",
|
|
19
|
+
asValue(options.customAdapter.constructor)
|
|
20
|
+
)
|
|
21
|
+
container.register(
|
|
22
|
+
"storageProviderCtrOptions",
|
|
23
|
+
asValue(options.customAdapter.options)
|
|
24
|
+
)
|
|
25
|
+
}*/
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loaders/index.ts"],"names":[],"mappings":";;AAAA,mCAAyC;AACzC,qEAAgE;AAChE,kDAAiF;AACjF,yCAA8C;AAG9C,kBAAe,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAiB,EAAiB,EAAE;IAC5E,SAAS,CAAC,QAAQ,CAAC;QACjB,cAAc,EAAE,IAAA,gBAAO,EAAC,8BAAc,CAAC,CAAC,SAAS,EAAE;QACnD,mBAAmB,EAAE,IAAA,gBAAO,EAAC,8BAAkB,CAAC,CAAC,SAAS,EAAE;KAC7D,CAAC,CAAA;IAEF,SAAS,CAAC,QAAQ,CAAC,2BAA2B,EAAE,IAAA,gBAAO,EAAC,SAAS,CAAC,CAAC,CAAA;IAEnE,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,IAAA,gBAAO,EAAC,oCAAgB,CAAC,CAAC,CAAA;IAEnE;;;;;;;;;;;OAWG;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20231019174230.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20231019174230.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAiB1B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20231019174230 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20231019174230 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql(`create table "index_data" ("id" text not null, "name" text not null, "data" jsonb not null default '{}', constraint "index_data_pkey" primary key ("id", "name")) PARTITION BY LIST("name");`);
|
|
8
|
+
this.addSql(`create index "IDX_index_data_id" on "index_data" ("id");`);
|
|
9
|
+
this.addSql(`create index "IDX_index_data_name" on "index_data" ("name");`);
|
|
10
|
+
this.addSql(`create index "IDX_index_data_gin" on "index_data" using GIN ("data");`);
|
|
11
|
+
this.addSql(`create table "index_relation" ("id" bigserial, "pivot" text not null, "parent_id" text not null, "parent_name" text not null, "child_id" text not null, "child_name" text not null, constraint "index_relation_pkey" primary key ("id", "pivot")) PARTITION BY LIST("pivot");`);
|
|
12
|
+
this.addSql(`create index "IDX_index_relation_child_id" on "index_relation" ("child_id");`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Migration20231019174230 = Migration20231019174230;
|
|
16
|
+
//# sourceMappingURL=Migration20231019174230.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20231019174230.js","sourceRoot":"","sources":["../../src/migrations/Migration20231019174230.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CACT,8LAA8L,CAC/L,CAAA;QACD,IAAI,CAAC,MAAM,CAAC,0DAA0D,CAAC,CAAA;QACvE,IAAI,CAAC,MAAM,CAAC,8DAA8D,CAAC,CAAA;QAC3E,IAAI,CAAC,MAAM,CACT,uEAAuE,CACxE,CAAA;QAED,IAAI,CAAC,MAAM,CACT,+QAA+Q,CAChR,CAAA;QACD,IAAI,CAAC,MAAM,CACT,8EAA8E,CAC/E,CAAA;IACH,CAAC;CACF;AAlBD,0DAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20241209173313.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20241209173313.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,qBAAa,uBAAwB,SAAQ,SAAS;IAC9C,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAe5B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20241209173313 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20241209173313 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql(`
|
|
8
|
+
ALTER TABLE "index_data"
|
|
9
|
+
ADD COLUMN IF NOT EXISTS "created_at" timestamptz NOT NULL DEFAULT now(),
|
|
10
|
+
ADD COLUMN IF NOT EXISTS "updated_at" timestamptz NOT NULL DEFAULT now(),
|
|
11
|
+
ADD COLUMN IF NOT EXISTS "deleted_at" timestamptz NULL;
|
|
12
|
+
`);
|
|
13
|
+
this.addSql(`
|
|
14
|
+
ALTER TABLE "index_relation"
|
|
15
|
+
ADD COLUMN IF NOT EXISTS "created_at" timestamptz NOT NULL DEFAULT now(),
|
|
16
|
+
ADD COLUMN IF NOT EXISTS "updated_at" timestamptz NOT NULL DEFAULT now(),
|
|
17
|
+
ADD COLUMN IF NOT EXISTS "deleted_at" timestamptz NULL;
|
|
18
|
+
`);
|
|
19
|
+
}
|
|
20
|
+
async down() {
|
|
21
|
+
this.addSql(`
|
|
22
|
+
ALTER TABLE "index_data"
|
|
23
|
+
DROP COLUMN IF EXISTS "created_at",
|
|
24
|
+
DROP COLUMN IF EXISTS "updated_at",
|
|
25
|
+
DROP COLUMN IF EXISTS "deleted_at";
|
|
26
|
+
`);
|
|
27
|
+
this.addSql(`
|
|
28
|
+
ALTER TABLE "index_relation"
|
|
29
|
+
DROP COLUMN IF EXISTS "created_at",
|
|
30
|
+
DROP COLUMN IF EXISTS "updated_at",
|
|
31
|
+
DROP COLUMN IF EXISTS "deleted_at";
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Migration20241209173313 = Migration20241209173313;
|
|
36
|
+
//# sourceMappingURL=Migration20241209173313.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Migration20241209173313.js","sourceRoot":"","sources":["../../src/migrations/Migration20241209173313.ts"],"names":[],"mappings":";;;AAAA,sDAAiD;AAEjD,MAAa,uBAAwB,SAAQ,sBAAS;IACpD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,MAAM,CAAC;;;;;KAKX,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC;;;;;KAKX,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,CAAC;;;;;KAKX,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC;;;;;KAKX,CAAC,CAAA;IACJ,CAAC;CACF;AAhCD,0DAgCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const IndexData: import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<{
|
|
2
|
+
id: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
3
|
+
name: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
4
|
+
data: import("@etohq/framework/utils").JSONProperty;
|
|
5
|
+
parents: import("@etohq/framework/utils").ManyToMany<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<any>, "IndexData">>;
|
|
6
|
+
children: import("@etohq/framework/utils").ManyToMany<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<any>, "IndexData">>;
|
|
7
|
+
}>, "IndexData">;
|
|
8
|
+
export default IndexData;
|
|
9
|
+
//# sourceMappingURL=index-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-data.d.ts","sourceRoot":"","sources":["../../src/models/index-data.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS;;;;;;gBA6BX,CAAA;AAEJ,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
7
|
+
const index_relation_1 = __importDefault(require("./index-relation"));
|
|
8
|
+
const IndexData = utils_1.model
|
|
9
|
+
.define("IndexData", {
|
|
10
|
+
id: utils_1.model.text().primaryKey(),
|
|
11
|
+
name: utils_1.model.text().primaryKey(),
|
|
12
|
+
data: utils_1.model.json().default({}),
|
|
13
|
+
parents: utils_1.model.manyToMany(() => IndexData, {
|
|
14
|
+
mappedBy: "children",
|
|
15
|
+
pivotEntity: () => index_relation_1.default,
|
|
16
|
+
joinColumn: ["child_id", "child_name"],
|
|
17
|
+
inverseJoinColumn: ["parent_id", "parent_name"],
|
|
18
|
+
}),
|
|
19
|
+
children: utils_1.model.manyToMany(() => IndexData, {
|
|
20
|
+
mappedBy: "parents",
|
|
21
|
+
}),
|
|
22
|
+
})
|
|
23
|
+
.indexes([
|
|
24
|
+
{
|
|
25
|
+
name: "IDX_index_data_gin",
|
|
26
|
+
type: "GIN",
|
|
27
|
+
on: ["data"],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "IDX_index_data_id",
|
|
31
|
+
on: ["id"],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "IDX_index_data_name",
|
|
35
|
+
on: ["name"],
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
exports.default = IndexData;
|
|
39
|
+
//# sourceMappingURL=index-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-data.js","sourceRoot":"","sources":["../../src/models/index-data.ts"],"names":[],"mappings":";;;;;AAAA,kDAA8C;AAC9C,sEAA4C;AAE5C,MAAM,SAAS,GAAG,aAAK;KACpB,MAAM,CAAC,WAAW,EAAE;IACnB,EAAE,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAC7B,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAC/B,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9B,OAAO,EAAE,aAAK,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE;QACzC,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,GAAG,EAAE,CAAC,wBAAa;QAChC,UAAU,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;QACtC,iBAAiB,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC;KAChD,CAAC;IACF,QAAQ,EAAE,aAAK,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE;QAC1C,QAAQ,EAAE,SAAS;KACpB,CAAC;CACH,CAAC;KACD,OAAO,CAAC;IACP;QACE,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,CAAC,MAAM,CAAC;KACb;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,EAAE,EAAE,CAAC,IAAI,CAAC;KACX;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,EAAE,EAAE,CAAC,MAAM,CAAC;KACb;CACF,CAAC,CAAA;AAEJ,kBAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const IndexRelation: import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<{
|
|
2
|
+
id: import("@etohq/framework/utils").PrimaryKeyModifier<number, import("@etohq/framework/utils").AutoIncrementProperty>;
|
|
3
|
+
pivot: import("@etohq/framework/utils").TextProperty;
|
|
4
|
+
parent_name: import("@etohq/framework/utils").TextProperty;
|
|
5
|
+
child_name: import("@etohq/framework/utils").TextProperty;
|
|
6
|
+
parent: import("@etohq/framework/utils").BelongsTo<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<{
|
|
7
|
+
id: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
8
|
+
name: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
9
|
+
data: import("@etohq/framework/utils").JSONProperty;
|
|
10
|
+
parents: import("@etohq/framework/utils").ManyToMany<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<any>, "IndexData">>;
|
|
11
|
+
children: import("@etohq/framework/utils").ManyToMany<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<any>, "IndexData">>;
|
|
12
|
+
}>, "IndexData">, undefined>;
|
|
13
|
+
child: import("@etohq/framework/utils").BelongsTo<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<{
|
|
14
|
+
id: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
15
|
+
name: import("@etohq/framework/utils").PrimaryKeyModifier<string, import("@etohq/framework/utils").TextProperty>;
|
|
16
|
+
data: import("@etohq/framework/utils").JSONProperty;
|
|
17
|
+
parents: import("@etohq/framework/utils").ManyToMany<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<any>, "IndexData">>;
|
|
18
|
+
children: import("@etohq/framework/utils").ManyToMany<() => import("@etohq/framework/utils").DmlEntity<import("@etohq/framework/utils").DMLEntitySchemaBuilder<any>, "IndexData">>;
|
|
19
|
+
}>, "IndexData">, undefined>;
|
|
20
|
+
}>, "IndexRelation">;
|
|
21
|
+
export default IndexRelation;
|
|
22
|
+
//# sourceMappingURL=index-relation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-relation.d.ts","sourceRoot":"","sources":["../../src/models/index-relation.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;oBAWjB,CAAA;AACF,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
7
|
+
const index_data_1 = __importDefault(require("./index-data"));
|
|
8
|
+
const IndexRelation = utils_1.model.define("IndexRelation", {
|
|
9
|
+
id: utils_1.model.autoincrement().primaryKey(),
|
|
10
|
+
pivot: utils_1.model.text(),
|
|
11
|
+
parent_name: utils_1.model.text(),
|
|
12
|
+
child_name: utils_1.model.text(),
|
|
13
|
+
parent: utils_1.model.belongsTo(() => index_data_1.default, {
|
|
14
|
+
mappedBy: "parents",
|
|
15
|
+
}),
|
|
16
|
+
child: utils_1.model.belongsTo(() => index_data_1.default, {
|
|
17
|
+
mappedBy: "children",
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
exports.default = IndexRelation;
|
|
21
|
+
//# sourceMappingURL=index-relation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-relation.js","sourceRoot":"","sources":["../../src/models/index-relation.ts"],"names":[],"mappings":";;;;;AAAA,kDAA8C;AAC9C,8DAAoC;AAEpC,MAAM,aAAa,GAAG,aAAK,CAAC,MAAM,CAAC,eAAe,EAAE;IAClD,EAAE,EAAE,aAAK,CAAC,aAAa,EAAE,CAAC,UAAU,EAAE;IACtC,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;IACnB,WAAW,EAAE,aAAK,CAAC,IAAI,EAAE;IACzB,UAAU,EAAE,aAAK,CAAC,IAAI,EAAE;IACxB,MAAM,EAAE,aAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,oBAAS,EAAE;QACvC,QAAQ,EAAE,SAAS;KACpB,CAAC;IACF,KAAK,EAAE,aAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,oBAAS,EAAE;QACtC,QAAQ,EAAE,UAAU;KACrB,CAAC;CACH,CAAC,CAAA;AACF,kBAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IndexRelation = exports.IndexData = void 0;
|
|
7
|
+
var index_data_1 = require("./index-data");
|
|
8
|
+
Object.defineProperty(exports, "IndexData", { enumerable: true, get: function () { return __importDefault(index_data_1).default; } });
|
|
9
|
+
var index_relation_1 = require("./index-relation");
|
|
10
|
+
Object.defineProperty(exports, "IndexRelation", { enumerable: true, get: function () { return __importDefault(index_relation_1).default; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAmD;AAA1C,wHAAA,OAAO,OAAa;AAC7B,mDAA2D;AAAlD,gIAAA,OAAO,OAAiB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Constructor, IEventBusModuleService, IndexTypes, InternalModuleDeclaration, RemoteQueryFunction } from "@etohq/framework/types";
|
|
2
|
+
import { ContainerRegistrationKeys, MikroOrmBaseRepository as BaseRepository, Modules } from "@etohq/framework/utils";
|
|
3
|
+
type InjectedDependencies = {
|
|
4
|
+
[Modules.EVENT_BUS]: IEventBusModuleService;
|
|
5
|
+
storageProviderCtr: Constructor<IndexTypes.StorageProvider>;
|
|
6
|
+
[ContainerRegistrationKeys.QUERY]: RemoteQueryFunction;
|
|
7
|
+
storageProviderCtrOptions: unknown;
|
|
8
|
+
baseRepository: BaseRepository;
|
|
9
|
+
};
|
|
10
|
+
export default class IndexModuleService implements IndexTypes.IIndexService {
|
|
11
|
+
protected readonly moduleDeclaration: InternalModuleDeclaration;
|
|
12
|
+
private readonly container_;
|
|
13
|
+
private readonly moduleOptions_;
|
|
14
|
+
protected readonly eventBusModuleService_: IEventBusModuleService;
|
|
15
|
+
protected schemaObjectRepresentation_: IndexTypes.SchemaObjectRepresentation;
|
|
16
|
+
protected schemaEntitiesMap_: Record<string, any>;
|
|
17
|
+
protected readonly storageProviderCtr_: Constructor<IndexTypes.StorageProvider>;
|
|
18
|
+
protected readonly storageProviderCtrOptions_: unknown;
|
|
19
|
+
protected storageProvider_: IndexTypes.StorageProvider;
|
|
20
|
+
constructor(container: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
|
|
21
|
+
__hooks: {
|
|
22
|
+
onApplicationStart(this: IndexModuleService): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
protected onApplicationStart_(): Promise<void>;
|
|
25
|
+
query<const TEntry extends string>(config: IndexTypes.IndexQueryConfig<TEntry>): Promise<IndexTypes.QueryResultSet<TEntry>>;
|
|
26
|
+
protected registerListeners(): void;
|
|
27
|
+
private buildSchemaObjectRepresentation_;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=index-module-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-module-service.d.ts","sourceRoot":"","sources":["../../src/services/index-module-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,UAAU,EACV,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,yBAAyB,EACzB,sBAAsB,IAAI,cAAc,EACxC,OAAO,EACR,MAAM,wBAAwB,CAAA;AAM/B,KAAK,oBAAoB,GAAG;IAC1B,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,sBAAsB,CAAA;IAC3C,kBAAkB,EAAE,WAAW,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;IAC3D,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAA;IACtD,yBAAyB,EAAE,OAAO,CAAA;IAClC,cAAc,EAAE,cAAc,CAAA;CAC/B,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,YAAW,UAAU,CAAC,aAAa;IAgBvE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB;IAfjE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA+B;IAE9D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAA;IAEjE,SAAS,CAAC,2BAA2B,EAAE,UAAU,CAAC,0BAA0B,CAAA;IAC5E,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAEjD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;IAC/E,SAAS,CAAC,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAA;IAEtD,SAAS,CAAC,gBAAgB,EAAE,UAAU,CAAC,eAAe,CAAA;gBAGpD,SAAS,EAAE,oBAAoB,EACZ,iBAAiB,EAAE,yBAAyB;IAuBjE,OAAO;iCACoB,kBAAkB;MAG5C;cAEe,mBAAmB;IAyB7B,KAAK,CAAC,KAAK,CAAC,MAAM,SAAS,MAAM,EACrC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAC1C,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAI7C,SAAS,CAAC,iBAAiB;IAsB3B,OAAO,CAAC,gCAAgC;CAczC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
4
|
+
const _types_1 = require("../types");
|
|
5
|
+
const build_config_1 = require("../utils/build-config");
|
|
6
|
+
const default_schema_1 = require("../utils/default-schema");
|
|
7
|
+
const gql_to_types_1 = require("../utils/gql-to-types");
|
|
8
|
+
class IndexModuleService {
|
|
9
|
+
constructor(container, moduleDeclaration) {
|
|
10
|
+
this.moduleDeclaration = moduleDeclaration;
|
|
11
|
+
this.__hooks = {
|
|
12
|
+
onApplicationStart() {
|
|
13
|
+
return this.onApplicationStart_();
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
this.container_ = container;
|
|
17
|
+
this.moduleOptions_ = (moduleDeclaration.options ??
|
|
18
|
+
moduleDeclaration);
|
|
19
|
+
const { [utils_1.Modules.EVENT_BUS]: eventBusModuleService, storageProviderCtr, storageProviderCtrOptions, } = container;
|
|
20
|
+
this.eventBusModuleService_ = eventBusModuleService;
|
|
21
|
+
this.storageProviderCtr_ = storageProviderCtr;
|
|
22
|
+
this.storageProviderCtrOptions_ = storageProviderCtrOptions;
|
|
23
|
+
if (!this.eventBusModuleService_) {
|
|
24
|
+
throw new Error("EventBusModuleService is required for the IndexModule to work");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async onApplicationStart_() {
|
|
28
|
+
try {
|
|
29
|
+
this.buildSchemaObjectRepresentation_();
|
|
30
|
+
this.storageProvider_ = new this.storageProviderCtr_(this.container_, Object.assign(this.storageProviderCtrOptions_ ?? {}, {
|
|
31
|
+
schemaObjectRepresentation: this.schemaObjectRepresentation_,
|
|
32
|
+
entityMap: this.schemaEntitiesMap_,
|
|
33
|
+
}), this.moduleOptions_);
|
|
34
|
+
this.registerListeners();
|
|
35
|
+
if (this.storageProvider_.onApplicationStart) {
|
|
36
|
+
await this.storageProvider_.onApplicationStart();
|
|
37
|
+
}
|
|
38
|
+
await (0, gql_to_types_1.gqlSchemaToTypes)(this.moduleOptions_.schema ?? default_schema_1.defaultSchema);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
console.log(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async query(config) {
|
|
45
|
+
return await this.storageProvider_.query(config);
|
|
46
|
+
}
|
|
47
|
+
registerListeners() {
|
|
48
|
+
const schemaObjectRepresentation = (this.schemaObjectRepresentation_ ??
|
|
49
|
+
{});
|
|
50
|
+
for (const [entityName, schemaEntityObjectRepresentation] of Object.entries(schemaObjectRepresentation)) {
|
|
51
|
+
if (_types_1.schemaObjectRepresentationPropertiesToOmit.includes(entityName)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
;
|
|
55
|
+
schemaEntityObjectRepresentation.listeners.forEach((listener) => {
|
|
56
|
+
this.eventBusModuleService_.subscribe(listener, this.storageProvider_.consumeEvent(schemaEntityObjectRepresentation));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
buildSchemaObjectRepresentation_() {
|
|
61
|
+
if (this.schemaObjectRepresentation_) {
|
|
62
|
+
return this.schemaObjectRepresentation_;
|
|
63
|
+
}
|
|
64
|
+
const [objectRepresentation, entityMap] = (0, build_config_1.buildSchemaObjectRepresentation)(this.moduleOptions_.schema ?? default_schema_1.defaultSchema);
|
|
65
|
+
this.schemaObjectRepresentation_ = objectRepresentation;
|
|
66
|
+
this.schemaEntitiesMap_ = entityMap;
|
|
67
|
+
return this.schemaObjectRepresentation_;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.default = IndexModuleService;
|
|
71
|
+
//# sourceMappingURL=index-module-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-module-service.js","sourceRoot":"","sources":["../../src/services/index-module-service.ts"],"names":[],"mappings":";;AAOA,kDAI+B;AAC/B,mCAAmE;AACnE,wDAAuE;AACvE,4DAAuD;AACvD,wDAAwD;AAUxD,MAAqB,kBAAkB;IAcrC,YACE,SAA+B,EACZ,iBAA4C;QAA5C,sBAAiB,GAAjB,iBAAiB,CAA2B;QAuBjE,YAAO,GAAG;YACR,kBAAkB;gBAChB,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAA;YACnC,CAAC;SACF,CAAA;QAzBC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3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use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IndexModuleService = void 0;
|
|
7
|
+
var index_module_service_1 = require("./index-module-service");
|
|
8
|
+
Object.defineProperty(exports, "IndexModuleService", { enumerable: true, get: function () { return __importDefault(index_module_service_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAsE;AAA7D,2IAAA,OAAO,OAAsB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Context, Event, IndexTypes, RemoteQueryFunction, Subscriber } from "@etohq/framework/types";
|
|
2
|
+
import { MikroOrmBaseRepository as BaseRepository, ContainerRegistrationKeys } from "@etohq/framework/utils";
|
|
3
|
+
import { EntityManager, SqlEntityManager } from "@mikro-orm/postgresql";
|
|
4
|
+
type InjectedDependencies = {
|
|
5
|
+
manager: EntityManager;
|
|
6
|
+
[ContainerRegistrationKeys.QUERY]: RemoteQueryFunction;
|
|
7
|
+
baseRepository: BaseRepository;
|
|
8
|
+
};
|
|
9
|
+
export declare class PostgresProvider implements IndexTypes.StorageProvider {
|
|
10
|
+
#private;
|
|
11
|
+
protected readonly eventActionToMethodMap_: {
|
|
12
|
+
created: string;
|
|
13
|
+
updated: string;
|
|
14
|
+
deleted: string;
|
|
15
|
+
attached: string;
|
|
16
|
+
detached: string;
|
|
17
|
+
};
|
|
18
|
+
protected container_: InjectedDependencies;
|
|
19
|
+
protected readonly schemaObjectRepresentation_: IndexTypes.SchemaObjectRepresentation;
|
|
20
|
+
protected readonly schemaEntitiesMap_: Record<string, any>;
|
|
21
|
+
protected readonly moduleOptions_: IndexTypes.IndexModuleOptions;
|
|
22
|
+
protected readonly manager_: SqlEntityManager;
|
|
23
|
+
protected readonly query_: RemoteQueryFunction;
|
|
24
|
+
protected baseRepository_: BaseRepository;
|
|
25
|
+
constructor(container: InjectedDependencies, options: {
|
|
26
|
+
schemaObjectRepresentation: IndexTypes.SchemaObjectRepresentation;
|
|
27
|
+
entityMap: Record<string, any>;
|
|
28
|
+
}, moduleOptions: IndexTypes.IndexModuleOptions);
|
|
29
|
+
onApplicationStart(): Promise<void>;
|
|
30
|
+
protected static parseData<TData extends {
|
|
31
|
+
id: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}>(data: TData | TData[], schemaEntityObjectRepresentation: IndexTypes.SchemaObjectEntityRepresentation): {
|
|
34
|
+
data: TData[];
|
|
35
|
+
entityProperties: string[];
|
|
36
|
+
parentsProperties: {
|
|
37
|
+
[entity: string]: string[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
protected static parseMessageData<T>(message?: Event): {
|
|
41
|
+
action: string;
|
|
42
|
+
data: {
|
|
43
|
+
id: string;
|
|
44
|
+
}[];
|
|
45
|
+
ids: string[];
|
|
46
|
+
} | void;
|
|
47
|
+
consumeEvent(schemaEntityObjectRepresentation: IndexTypes.SchemaObjectEntityRepresentation): Subscriber<{
|
|
48
|
+
id: string;
|
|
49
|
+
}>;
|
|
50
|
+
query<const TEntry extends string>(config: IndexTypes.IndexQueryConfig<TEntry>, sharedContext?: Context): Promise<IndexTypes.QueryResultSet<TEntry>>;
|
|
51
|
+
/**
|
|
52
|
+
* Create the index entry and the index relation entry when this event is emitted.
|
|
53
|
+
* @param entity
|
|
54
|
+
* @param data
|
|
55
|
+
* @param schemaEntityObjectRepresentation
|
|
56
|
+
* @param sharedContext
|
|
57
|
+
* @protected
|
|
58
|
+
*/
|
|
59
|
+
protected onCreate<TData extends {
|
|
60
|
+
id: string;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
63
|
+
entity: string;
|
|
64
|
+
data: TData | TData[];
|
|
65
|
+
schemaEntityObjectRepresentation: IndexTypes.SchemaObjectEntityRepresentation;
|
|
66
|
+
}, sharedContext?: Context): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Update the index entry when this event is emitted.
|
|
69
|
+
* @param entity
|
|
70
|
+
* @param data
|
|
71
|
+
* @param schemaEntityObjectRepresentation
|
|
72
|
+
* @param sharedContext
|
|
73
|
+
* @protected
|
|
74
|
+
*/
|
|
75
|
+
protected onUpdate<TData extends {
|
|
76
|
+
id: string;
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
79
|
+
entity: string;
|
|
80
|
+
data: TData | TData[];
|
|
81
|
+
schemaEntityObjectRepresentation: IndexTypes.SchemaObjectEntityRepresentation;
|
|
82
|
+
}, sharedContext?: Context): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Delete the index entry when this event is emitted.
|
|
85
|
+
* @param entity
|
|
86
|
+
* @param data
|
|
87
|
+
* @param schemaEntityObjectRepresentation
|
|
88
|
+
* @param sharedContext
|
|
89
|
+
* @protected
|
|
90
|
+
*/
|
|
91
|
+
protected onDelete<TData extends {
|
|
92
|
+
id: string;
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
95
|
+
entity: string;
|
|
96
|
+
data: TData | TData[];
|
|
97
|
+
schemaEntityObjectRepresentation: IndexTypes.SchemaObjectEntityRepresentation;
|
|
98
|
+
}, sharedContext?: Context): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* event emitted from the link modules to attach a link entity to its parent and child entities from the linked modules.
|
|
101
|
+
* @param entity
|
|
102
|
+
* @param data
|
|
103
|
+
* @param schemaEntityObjectRepresentation
|
|
104
|
+
* @protected
|
|
105
|
+
*/
|
|
106
|
+
protected onAttach<TData extends {
|
|
107
|
+
id: string;
|
|
108
|
+
[key: string]: unknown;
|
|
109
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
110
|
+
entity: string;
|
|
111
|
+
data: TData | TData[];
|
|
112
|
+
schemaEntityObjectRepresentation: IndexTypes.SchemaObjectEntityRepresentation;
|
|
113
|
+
}, sharedContext?: Context): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Event emitted from the link modules to detach a link entity from its parent and child entities from the linked modules.
|
|
116
|
+
* @param entity
|
|
117
|
+
* @param data
|
|
118
|
+
* @param schemaEntityObjectRepresentation
|
|
119
|
+
* @param sharedContext
|
|
120
|
+
* @protected
|
|
121
|
+
*/
|
|
122
|
+
protected onDetach<TData extends {
|
|
123
|
+
id: string;
|
|
124
|
+
[key: string]: unknown;
|
|
125
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
126
|
+
entity: string;
|
|
127
|
+
data: TData | TData[];
|
|
128
|
+
schemaEntityObjectRepresentation: IndexTypes.SchemaObjectEntityRepresentation;
|
|
129
|
+
}, sharedContext?: Context): Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=postgres-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-provider.d.ts","sourceRoot":"","sources":["../../src/services/postgres-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,UAAU,EACX,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,sBAAsB,IAAI,cAAc,EACxC,yBAAyB,EAM1B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAMvE,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,aAAa,CAAA;IACtB,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAA;IACtD,cAAc,EAAE,cAAc,CAAA;CAC/B,CAAA;AAED,qBAAa,gBAAiB,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