@spinajs/queue-orm-transport 2.0.50
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 +11 -0
- package/lib/config/queueOrmTransport.d.ts +2 -0
- package/lib/config/queueOrmTransport.d.ts.map +1 -0
- package/lib/config/queueOrmTransport.js +3 -0
- package/lib/config/queueOrmTransport.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +56 -0
- package/lib/index.js.map +1 -0
- package/lib/migrations/OrmEventTransportInitial_2022_06_28_01_13_00.d.ts +6 -0
- package/lib/migrations/OrmEventTransportInitial_2022_06_28_01_13_00.d.ts.map +1 -0
- package/lib/migrations/OrmEventTransportInitial_2022_06_28_01_13_00.js +44 -0
- package/lib/migrations/OrmEventTransportInitial_2022_06_28_01_13_00.js.map +1 -0
- package/lib/models/Event.d.ts +14 -0
- package/lib/models/Event.d.ts.map +1 -0
- package/lib/models/Event.js +36 -0
- package/lib/models/Event.js.map +1 -0
- package/lib/models/Queue.d.ts +14 -0
- package/lib/models/Queue.d.ts.map +1 -0
- package/lib/models/Queue.js +31 -0
- package/lib/models/Queue.js.map +1 -0
- package/lib/models/Subscriber.d.ts +13 -0
- package/lib/models/Subscriber.d.ts.map +1 -0
- package/lib/models/Subscriber.js +37 -0
- package/lib/models/Subscriber.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queueOrmTransport.d.ts","sourceRoot":"","sources":["../../src/config/queueOrmTransport.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queueOrmTransport.js","sourceRoot":"","sources":["../../src/config/queueOrmTransport.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// import { Message, QueueClient } from '@spinajs/queue';
|
|
2
|
+
// import { Event } from './models/event';
|
|
3
|
+
// import { Subscriber } from './models/Subscriber';
|
|
4
|
+
// import { Config } from '@spinajs/configuration';
|
|
5
|
+
// import { Queue } from './models/Queue';
|
|
6
|
+
// import { ILog, Logger } from '@spinajs/log';
|
|
7
|
+
export {};
|
|
8
|
+
// interface QueueOrmTransportConfig {
|
|
9
|
+
// TickInterval: number;
|
|
10
|
+
// }
|
|
11
|
+
// export class QueueOrmTransport extends QueueClient {
|
|
12
|
+
// @Logger('QueueOrmTransport')
|
|
13
|
+
// protected Log: ILog;
|
|
14
|
+
// @Config('queue.orm_transport')
|
|
15
|
+
// protected Config: QueueOrmTransportConfig;
|
|
16
|
+
// protected Subscriber: Subscriber;
|
|
17
|
+
// public async resolve(): Promise<void> {
|
|
18
|
+
// this.Subscriber = await Subscriber.where('Name', this.Options.name).first();
|
|
19
|
+
// if (!this.Subscriber) {
|
|
20
|
+
// this.Subscriber = new Subscriber({
|
|
21
|
+
// Name: this.Options.name,
|
|
22
|
+
// });
|
|
23
|
+
// await this.Subscriber.insert();
|
|
24
|
+
// this.Log.success(`Added ${this.Options.name} subscriber to queue`);
|
|
25
|
+
// }
|
|
26
|
+
// }
|
|
27
|
+
// public async dispatch(event: Message): Promise<boolean> {
|
|
28
|
+
// try {
|
|
29
|
+
// const e = new Event({
|
|
30
|
+
// Channel: event.Queue,
|
|
31
|
+
// Value: event.toJSON(),
|
|
32
|
+
// });
|
|
33
|
+
// const subscriber = await Subscriber.getOrCreate(null, {
|
|
34
|
+
// Name: this.Options.name,
|
|
35
|
+
// });
|
|
36
|
+
// await e.insert();
|
|
37
|
+
// await subscriber.Events.add(e);
|
|
38
|
+
// } catch (err) {
|
|
39
|
+
// return false;
|
|
40
|
+
// }
|
|
41
|
+
// return true;
|
|
42
|
+
// }
|
|
43
|
+
// public async subscribe(callback: (message: Message) => void) {
|
|
44
|
+
// setInterval(async () => {
|
|
45
|
+
// for (const e of sub.Events) {
|
|
46
|
+
// try {
|
|
47
|
+
// callback(e.Value as Message);
|
|
48
|
+
// await Queue.update({ Ack: true }).where('Id', e.Id);
|
|
49
|
+
// } catch (err) {
|
|
50
|
+
// this.Log.warn(`Cannot execute event ${e.constructor.name}, reason: ${JSON.stringify(err)}`);
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
// }, this.Config.TickInterval || 1000);
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,0CAA0C;AAC1C,oDAAoD;AACpD,mDAAmD;AACnD,0CAA0C;AAC1C,+CAA+C;;AAE/C,sCAAsC;AACtC,0BAA0B;AAC1B,IAAI;AAEJ,uDAAuD;AACvD,iCAAiC;AACjC,yBAAyB;AAEzB,mCAAmC;AACnC,+CAA+C;AAE/C,sCAAsC;AAEtC,4CAA4C;AAC5C,mFAAmF;AAEnF,8BAA8B;AAC9B,2CAA2C;AAC3C,mCAAmC;AACnC,YAAY;AAEZ,wCAAwC;AAExC,4EAA4E;AAC5E,QAAQ;AACR,MAAM;AAEN,8DAA8D;AAC9D,YAAY;AACZ,8BAA8B;AAC9B,gCAAgC;AAChC,iCAAiC;AACjC,YAAY;AAEZ,gEAAgE;AAChE,mCAAmC;AACnC,YAAY;AAEZ,0BAA0B;AAC1B,wCAAwC;AACxC,sBAAsB;AACtB,sBAAsB;AACtB,QAAQ;AAER,mBAAmB;AACnB,MAAM;AAEN,mEAAmE;AACnE,gCAAgC;AAChC,sCAAsC;AACtC,gBAAgB;AAChB,0CAA0C;AAC1C,iEAAiE;AACjE,0BAA0B;AAC1B,yGAAyG;AACzG,YAAY;AACZ,UAAU;AACV,4CAA4C;AAC5C,MAAM;AACN,IAAI"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OrmMigration, OrmDriver } from '@spinajs/orm';
|
|
2
|
+
export declare class OrmEventTransportInitial_2022_06_28_01_13_00 extends OrmMigration {
|
|
3
|
+
up(connection: OrmDriver): Promise<void>;
|
|
4
|
+
down(_connection: OrmDriver): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=OrmEventTransportInitial_2022_06_28_01_13_00.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrmEventTransportInitial_2022_06_28_01_13_00.d.ts","sourceRoot":"","sources":["../../src/migrations/OrmEventTransportInitial_2022_06_28_01_13_00.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAElE,qBACa,4CAA6C,SAAQ,YAAY;IAC/D,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCxC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
8
|
+
import { OrmMigration, Migration } from '@spinajs/orm';
|
|
9
|
+
let OrmEventTransportInitial_2022_06_28_01_13_00 = class OrmEventTransportInitial_2022_06_28_01_13_00 extends OrmMigration {
|
|
10
|
+
async up(connection) {
|
|
11
|
+
await connection.schema().createTable('orm_event_transport__event', (table) => {
|
|
12
|
+
table.int('Id').primaryKey().autoIncrement();
|
|
13
|
+
table.string('Type').notNull();
|
|
14
|
+
table.dateTime('CreatedAt').default().dateTime();
|
|
15
|
+
table.text('Value');
|
|
16
|
+
});
|
|
17
|
+
await connection.schema().createTable('orm_event_transport__subscribers', (table) => {
|
|
18
|
+
table.int('Id').primaryKey().autoIncrement();
|
|
19
|
+
table.string('Name', 32).notNull().unique();
|
|
20
|
+
table.dateTime('LastAck').notNull().default().dateTime();
|
|
21
|
+
});
|
|
22
|
+
await connection.schema().createTable('orm_event_transport__queue', (table) => {
|
|
23
|
+
table.int('orm_event_transport__subscribers_Id');
|
|
24
|
+
table.int('orm_event_transport__event_Id');
|
|
25
|
+
table.dateTime('Ack');
|
|
26
|
+
});
|
|
27
|
+
await connection.schema().createTable('orm_event_transport__job', (table) => {
|
|
28
|
+
table.int('Id').primaryKey().autoIncrement();
|
|
29
|
+
table.string('Type').notNull();
|
|
30
|
+
table.text('Value').notNull();
|
|
31
|
+
table.text('Result');
|
|
32
|
+
table.dateTime('CreatedAt').notNull().default().dateTime();
|
|
33
|
+
table.dateTime('FinishedAt').notNull().default().dateTime();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// tslint:disable-next-line: no-empty
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
38
|
+
async down(_connection) { }
|
|
39
|
+
};
|
|
40
|
+
OrmEventTransportInitial_2022_06_28_01_13_00 = __decorate([
|
|
41
|
+
Migration('orm-event-transport')
|
|
42
|
+
], OrmEventTransportInitial_2022_06_28_01_13_00);
|
|
43
|
+
export { OrmEventTransportInitial_2022_06_28_01_13_00 };
|
|
44
|
+
//# sourceMappingURL=OrmEventTransportInitial_2022_06_28_01_13_00.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrmEventTransportInitial_2022_06_28_01_13_00.js","sourceRoot":"","sources":["../../src/migrations/OrmEventTransportInitial_2022_06_28_01_13_00.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAa,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3D,IAAM,4CAA4C,GAAlD,MAAM,4CAA6C,SAAQ,YAAY;IACrE,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5E,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,CAAC;YAC7C,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;YAC/B,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;YACjD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,kCAAkC,EAAE,CAAC,KAAK,EAAE,EAAE;YAClF,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,CAAC;YAC7C,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;YAC5C,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5E,KAAK,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACjD,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;YAC3C,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,0BAA0B,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1E,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,CAAC;YAC7C,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrB,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;YAC3D,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC;IAED,qCAAqC;IACrC,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,WAAsB,IAAkB,CAAC;CAC5D,CAAA;AAlCY,4CAA4C;IADxD,SAAS,CAAC,qBAAqB,CAAC;GACpB,4CAA4C,CAkCxD;SAlCY,4CAA4C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { ModelBase } from '@spinajs/orm';
|
|
3
|
+
/**
|
|
4
|
+
* Base model for users used by auth and ACL system
|
|
5
|
+
*
|
|
6
|
+
* To add / extend fields simply extend this model and register as default user model in ACL service
|
|
7
|
+
*/
|
|
8
|
+
export declare class Event extends ModelBase {
|
|
9
|
+
Id: number;
|
|
10
|
+
Channel: string;
|
|
11
|
+
CreatedAt: DateTime;
|
|
12
|
+
Value: unknown;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAA+C,MAAM,cAAc,CAAC;AAEtF;;;;GAIG;AACH,qBAEa,KAAM,SAAQ,SAAS;IAE3B,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,MAAM,CAAC;IAGhB,SAAS,EAAE,QAAQ,CAAC;IAGpB,KAAK,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { DateTime } from 'luxon';
|
|
11
|
+
import { ModelBase, Primary, Connection, Model, CreatedAt, Json } from '@spinajs/orm';
|
|
12
|
+
/**
|
|
13
|
+
* Base model for users used by auth and ACL system
|
|
14
|
+
*
|
|
15
|
+
* To add / extend fields simply extend this model and register as default user model in ACL service
|
|
16
|
+
*/
|
|
17
|
+
let Event = class Event extends ModelBase {
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
Primary(),
|
|
21
|
+
__metadata("design:type", Number)
|
|
22
|
+
], Event.prototype, "Id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
CreatedAt(),
|
|
25
|
+
__metadata("design:type", DateTime)
|
|
26
|
+
], Event.prototype, "CreatedAt", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
Json(),
|
|
29
|
+
__metadata("design:type", Object)
|
|
30
|
+
], Event.prototype, "Value", void 0);
|
|
31
|
+
Event = __decorate([
|
|
32
|
+
Connection('orm-event-transport'),
|
|
33
|
+
Model('orm_event_transport__event')
|
|
34
|
+
], Event);
|
|
35
|
+
export { Event };
|
|
36
|
+
//# sourceMappingURL=Event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../../src/models/Event.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEtF;;;;GAIG;AAGI,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,SAAS;CAWnC,CAAA;AAVC;IAAC,OAAO,EAAE;;iCACQ;AAIlB;IAAC,SAAS,EAAE;8BACM,QAAQ;wCAAC;AAE3B;IAAC,IAAI,EAAE;;oCACe;AAVX,KAAK;IAFjB,UAAU,CAAC,qBAAqB,CAAC;IACjC,KAAK,CAAC,4BAA4B,CAAC;GACvB,KAAK,CAWjB;SAXY,KAAK"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Subscriber } from './Subscriber.js';
|
|
2
|
+
import { ModelBase, SingleRelation } from '@spinajs/orm';
|
|
3
|
+
import type { Event } from './Event.js';
|
|
4
|
+
/**
|
|
5
|
+
* Base model for users used by auth and ACL system
|
|
6
|
+
*
|
|
7
|
+
* To add / extend fields simply extend this model and register as default user model in ACL service
|
|
8
|
+
*/
|
|
9
|
+
export declare class Queue extends ModelBase {
|
|
10
|
+
Event: SingleRelation<Event>;
|
|
11
|
+
Subscriber: SingleRelation<Subscriber>;
|
|
12
|
+
Ack: boolean;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue.d.ts","sourceRoot":"","sources":["../../src/models/Queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAgC,cAAc,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC;;;;GAIG;AACH,qBAEa,KAAM,SAAQ,SAAS;IAE3B,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAG7B,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAEvC,GAAG,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ModelBase, Connection, Model, BelongsTo, SingleRelation } from '@spinajs/orm';
|
|
11
|
+
/**
|
|
12
|
+
* Base model for users used by auth and ACL system
|
|
13
|
+
*
|
|
14
|
+
* To add / extend fields simply extend this model and register as default user model in ACL service
|
|
15
|
+
*/
|
|
16
|
+
let Queue = class Queue extends ModelBase {
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
BelongsTo('Event', 'orm_event_transport__event_Id', 'Id'),
|
|
20
|
+
__metadata("design:type", SingleRelation)
|
|
21
|
+
], Queue.prototype, "Event", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
BelongsTo('Subscriber', 'orm_event_transport__subscribers_Id', 'Id'),
|
|
24
|
+
__metadata("design:type", SingleRelation)
|
|
25
|
+
], Queue.prototype, "Subscriber", void 0);
|
|
26
|
+
Queue = __decorate([
|
|
27
|
+
Connection('orm-event-transport'),
|
|
28
|
+
Model('orm_event_transport__queue')
|
|
29
|
+
], Queue);
|
|
30
|
+
export { Queue };
|
|
31
|
+
//# sourceMappingURL=Queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue.js","sourceRoot":"","sources":["../../src/models/Queue.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEvF;;;;GAIG;AAGI,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,SAAS;CAQnC,CAAA;AAPC;IAAC,SAAS,CAAC,OAAO,EAAE,+BAA+B,EAAE,IAAI,CAAC;8BAC5C,cAAc;oCAAQ;AAEpC;IAAC,SAAS,CAAC,YAAY,EAAE,qCAAqC,EAAE,IAAI,CAAC;8BAClD,cAAc;yCAAa;AALnC,KAAK;IAFjB,UAAU,CAAC,qBAAqB,CAAC;IACjC,KAAK,CAAC,4BAA4B,CAAC;GACvB,KAAK,CAQjB;SARY,KAAK"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Event } from './Event.js';
|
|
2
|
+
import { ModelBase, ManyToManyRelationList } from '@spinajs/orm';
|
|
3
|
+
/**
|
|
4
|
+
* Base model for users used by auth and ACL system
|
|
5
|
+
*
|
|
6
|
+
* To add / extend fields simply extend this model and register as default user model in ACL service
|
|
7
|
+
*/
|
|
8
|
+
export declare class Subscriber extends ModelBase {
|
|
9
|
+
Id: number;
|
|
10
|
+
Name: string;
|
|
11
|
+
Events: ManyToManyRelationList<Event, Subscriber>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Subscriber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subscriber.d.ts","sourceRoot":"","sources":["../../src/models/Subscriber.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAA6C,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE5G;;;;GAIG;AACH,qBAEa,UAAW,SAAQ,SAAS;IAEhC,EAAE,EAAE,MAAM,CAAC;IAGX,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,EAAE,sBAAsB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CAC1D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Queue } from './Queue.js';
|
|
11
|
+
import { Event } from './Event.js';
|
|
12
|
+
import { ModelBase, Primary, Connection, Model, HasManyToMany, ManyToManyRelationList } from '@spinajs/orm';
|
|
13
|
+
/**
|
|
14
|
+
* Base model for users used by auth and ACL system
|
|
15
|
+
*
|
|
16
|
+
* To add / extend fields simply extend this model and register as default user model in ACL service
|
|
17
|
+
*/
|
|
18
|
+
let Subscriber = class Subscriber extends ModelBase {
|
|
19
|
+
};
|
|
20
|
+
__decorate([
|
|
21
|
+
Primary(),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], Subscriber.prototype, "Id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
Primary(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], Subscriber.prototype, "Name", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
HasManyToMany(Queue, Event, 'Id', 'Id', 'orm_event_transport__event_Id', 'orm_event_transport__subscribers_Id'),
|
|
30
|
+
__metadata("design:type", ManyToManyRelationList)
|
|
31
|
+
], Subscriber.prototype, "Events", void 0);
|
|
32
|
+
Subscriber = __decorate([
|
|
33
|
+
Connection('orm-event-transport'),
|
|
34
|
+
Model('orm_event_transport__subscribers')
|
|
35
|
+
], Subscriber);
|
|
36
|
+
export { Subscriber };
|
|
37
|
+
//# sourceMappingURL=Subscriber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subscriber.js","sourceRoot":"","sources":["../../src/models/Subscriber.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE5G;;;;GAIG;AAGI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,SAAS;CASxC,CAAA;AARC;IAAC,OAAO,EAAE;;sCACQ;AAElB;IAAC,OAAO,EAAE;;wCACU;AAEpB;IAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,+BAA+B,EAAE,qCAAqC,CAAC;8BACjG,sBAAsB;0CAAoB;AAR9C,UAAU;IAFtB,UAAU,CAAC,qBAAqB,CAAC;IACjC,KAAK,CAAC,kCAAkC,CAAC;GAC7B,UAAU,CAStB;SATY,UAAU"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spinajs/queue-orm-transport",
|
|
3
|
+
"version": "2.0.50",
|
|
4
|
+
"description": "simple job transport based on sqlite. Reads & writes jobs to execute in local sqlite database. used for testing & simple projects",
|
|
5
|
+
"exports": "./lib/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"private": false,
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=16.11"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npm run clean && npm run compile",
|
|
13
|
+
"compile": "tsc -b tsconfig.json",
|
|
14
|
+
"rimraf": "./node_modules/rimraf/bin.js",
|
|
15
|
+
"clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo",
|
|
16
|
+
"test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
|
|
17
|
+
"coverage": "nyc npm run test",
|
|
18
|
+
"build-docs": "rimraf docs && typedoc --options typedoc.json src/",
|
|
19
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
20
|
+
"lint": "eslint -c .eslintrc.cjs --ext .ts src --fix",
|
|
21
|
+
"preversion": "npm run lint",
|
|
22
|
+
"version": "npm run format && git add -A src",
|
|
23
|
+
"postinstall": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"lib/**/*"
|
|
27
|
+
],
|
|
28
|
+
"types": "lib",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/spinajs/main.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"spinajs",
|
|
35
|
+
"http"
|
|
36
|
+
],
|
|
37
|
+
"author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/main)",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/spinajs/main/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/spinajs/main#readme",
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/luxon": "^2.3.1",
|
|
45
|
+
"@types/node": "^16.11.11"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@spinajs/configuration": "^2.0.46",
|
|
49
|
+
"@spinajs/di": "^2.0.46",
|
|
50
|
+
"@spinajs/exceptions": "^2.0.39",
|
|
51
|
+
"@spinajs/log": "^2.0.46",
|
|
52
|
+
"@spinajs/orm": "^2.0.46"
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee"
|
|
55
|
+
}
|