@tmlmobilidade/interfaces 20260717.1725.34 → 20260717.1747.14

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.
@@ -1,14 +1,10 @@
1
1
  export * from './alerts/index.js';
2
- export * from './dates/index.js';
3
2
  export * from './file-exports/index.js';
4
3
  export * from './files/index.js';
5
4
  export * from './gtfs-validations/index.js';
6
5
  export * from './locations/index.js';
7
6
  export * from './metrics/index.js';
8
7
  export * from './notifications/index.js';
9
- export * from './offer/fares.js';
10
- export * from './offer/index.js';
11
- export * from './offer/zones.js';
12
8
  export * from './pcgidb/index.js';
13
9
  export * from './plans/index.js';
14
10
  export * from './proposed-changes/index.js';
@@ -1,14 +1,10 @@
1
1
  export * from './alerts/index.js';
2
- export * from './dates/index.js';
3
2
  export * from './file-exports/index.js';
4
3
  export * from './files/index.js';
5
4
  export * from './gtfs-validations/index.js';
6
5
  export * from './locations/index.js';
7
6
  export * from './metrics/index.js';
8
7
  export * from './notifications/index.js';
9
- export * from './offer/fares.js';
10
- export * from './offer/index.js';
11
- export * from './offer/zones.js';
12
8
  export * from './pcgidb/index.js';
13
9
  export * from './plans/index.js';
14
10
  export * from './proposed-changes/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/interfaces",
3
- "version": "20260717.1725.34",
3
+ "version": "20260717.1747.14",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"
@@ -1,38 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type Annotation, type CreateAnnotationDto, type UpdateAnnotationDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class AnnotationsClass extends MongoCollectionClass<Annotation, CreateAnnotationDto, UpdateAnnotationDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<AnnotationsClass>;
11
- /**
12
- * Finds Annotation documents by agency IDs.
13
- *
14
- * @param ids - The agency IDs to search for
15
- * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- title: string;
28
- agency_ids: string[];
29
- dates: import("@tmlmobilidade/types").OperationalDate[];
30
- updated_by?: string | undefined;
31
- description?: string | undefined;
32
- }>[]>;
33
- protected getCollectionIndexes(): IndexDescription[];
34
- protected getCollectionName(): string;
35
- protected getEnvName(): string;
36
- }
37
- export declare const annotations: AnnotationsClass;
38
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateAnnotationSchema, UpdateAnnotationSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class AnnotationsClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateAnnotationSchema;
9
- updateSchema = UpdateAnnotationSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!AnnotationsClass._instance) {
15
- const instance = new AnnotationsClass();
16
- await instance.connect();
17
- AnnotationsClass._instance = instance;
18
- }
19
- return AnnotationsClass._instance;
20
- }
21
- /**
22
- * Finds Annotation documents by agency IDs.
23
- *
24
- * @param ids - The agency IDs to search for
25
- * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByAgencyIds(ids) {
28
- return this.mongoCollection.find({ agency_ids: { $in: ids } }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'annotations';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const annotations = asyncSingletonProxy(AnnotationsClass);
@@ -1,79 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreateEventDto, type Event, type UpdateEventDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class EventsClass extends MongoCollectionClass<Event, CreateEventDto, UpdateEventDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<EventsClass>;
11
- /**
12
- * Finds Event documents by agency IDs.
13
- *
14
- * @param ids - The agency IDs to search for
15
- * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- code: string;
28
- description: string;
29
- title: string;
30
- agency_ids: string[];
31
- dates: import("@tmlmobilidade/types").OperationalDate[];
32
- rules: ({
33
- event: {
34
- title: string;
35
- id: string;
36
- };
37
- dates: import("@tmlmobilidade/types").OperationalDate[];
38
- kind: "event_restriction";
39
- lines_mode: "exclude" | "include" | "all";
40
- all_day: boolean;
41
- end_time: string & z.BRAND<"HHMM">;
42
- start_time: string & z.BRAND<"HHMM">;
43
- _id?: string | undefined;
44
- name?: string | undefined;
45
- timepoints?: (string & z.BRAND<"HHMM">)[] | undefined;
46
- lines_to_exclude?: string[] | undefined;
47
- lines_to_include?: string[] | undefined;
48
- } | {
49
- event: {
50
- title: string;
51
- id: string;
52
- };
53
- dates: import("@tmlmobilidade/types").OperationalDate[];
54
- kind: "event_replacement";
55
- weekdays: (1 | 2 | 4 | 3 | 5 | 6 | 7)[];
56
- year_period_ids: string[];
57
- lines_mode: "exclude" | "include" | "all";
58
- _id?: string | undefined;
59
- name?: string | undefined;
60
- timepoints?: (string & z.BRAND<"HHMM">)[] | undefined;
61
- lines_to_exclude?: string[] | undefined;
62
- lines_to_include?: string[] | undefined;
63
- same_weekday?: boolean | undefined;
64
- })[];
65
- associated_patterns: {
66
- _id: string;
67
- code: string;
68
- headsign: string;
69
- line_id: string;
70
- route_id: string;
71
- }[];
72
- updated_by?: string | undefined;
73
- }>[]>;
74
- protected getCollectionIndexes(): IndexDescription[];
75
- protected getCollectionName(): string;
76
- protected getEnvName(): string;
77
- }
78
- export declare const events: EventsClass;
79
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateEventSchema, UpdateEventSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class EventsClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateEventSchema;
9
- updateSchema = UpdateEventSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!EventsClass._instance) {
15
- const instance = new EventsClass();
16
- await instance.connect();
17
- EventsClass._instance = instance;
18
- }
19
- return EventsClass._instance;
20
- }
21
- /**
22
- * Finds Event documents by agency IDs.
23
- *
24
- * @param ids - The agency IDs to search for
25
- * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByAgencyIds(ids) {
28
- return this.mongoCollection.find({ agency_ids: { $in: ids } }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'events';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const events = asyncSingletonProxy(EventsClass);
@@ -1,38 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreateHolidayDto, type Holiday, type UpdateHolidayDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class HolidaysClass extends MongoCollectionClass<Holiday, CreateHolidayDto, UpdateHolidayDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<HolidaysClass>;
11
- /**
12
- * Finds Holiday documents by agency IDs.
13
- *
14
- * @param ids - The agency IDs to search for
15
- * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- title: string;
28
- agency_ids: string[];
29
- dates: import("@tmlmobilidade/types").OperationalDate[];
30
- updated_by?: string | undefined;
31
- description?: string | undefined;
32
- }>[]>;
33
- protected getCollectionIndexes(): IndexDescription[];
34
- protected getCollectionName(): string;
35
- protected getEnvName(): string;
36
- }
37
- export declare const holidays: HolidaysClass;
38
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateHolidaySchema, UpdateHolidaySchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class HolidaysClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateHolidaySchema;
9
- updateSchema = UpdateHolidaySchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!HolidaysClass._instance) {
15
- const instance = new HolidaysClass();
16
- await instance.connect();
17
- HolidaysClass._instance = instance;
18
- }
19
- return HolidaysClass._instance;
20
- }
21
- /**
22
- * Finds Holiday documents by agency IDs.
23
- *
24
- * @param ids - The agency IDs to search for
25
- * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByAgencyIds(ids) {
28
- return this.mongoCollection.find({ agency_ids: { $in: ids } }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'holidays';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const holidays = asyncSingletonProxy(HolidaysClass);
@@ -1,4 +0,0 @@
1
- export * from './annotations.js';
2
- export * from './events.js';
3
- export * from './holidays.js';
4
- export * from './year-periods.js';
@@ -1,4 +0,0 @@
1
- export * from './annotations.js';
2
- export * from './events.js';
3
- export * from './holidays.js';
4
- export * from './year-periods.js';
@@ -1,39 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { CreateYearPeriodDto, UpdateYearPeriodDto, type YearPeriod } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class YearPeriodsClass extends MongoCollectionClass<YearPeriod, CreateYearPeriodDto, UpdateYearPeriodDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<YearPeriodsClass>;
11
- /**
12
- * Finds YearPeriod documents by agency ID.
13
- *
14
- * @param id - The agency ID to search for
15
- * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByAgencyId(id: string): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- name: string;
28
- agency_ids: string[];
29
- updated_by?: string | undefined;
30
- code?: string | undefined;
31
- color?: string | undefined;
32
- dates?: import("@tmlmobilidade/types").OperationalDate[] | undefined;
33
- }>[]>;
34
- protected getCollectionIndexes(): IndexDescription[];
35
- protected getCollectionName(): string;
36
- protected getEnvName(): string;
37
- }
38
- export declare const yearPeriods: YearPeriodsClass;
39
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateYearPeriodSchema, UpdateYearPeriodSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class YearPeriodsClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateYearPeriodSchema;
9
- updateSchema = UpdateYearPeriodSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!YearPeriodsClass._instance) {
15
- const instance = new YearPeriodsClass();
16
- await instance.connect();
17
- YearPeriodsClass._instance = instance;
18
- }
19
- return YearPeriodsClass._instance;
20
- }
21
- /**
22
- * Finds YearPeriod documents by agency ID.
23
- *
24
- * @param id - The agency ID to search for
25
- * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByAgencyId(id) {
28
- return this.mongoCollection.find({ agency_id: id }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'year_periods';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const yearPeriods = asyncSingletonProxy(YearPeriodsClass);
@@ -1,41 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreateFareDto, type Fare, type UpdateFareDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class FaresClass extends MongoCollectionClass<Fare, CreateFareDto, UpdateFareDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<FaresClass>;
11
- /**
12
- * Finds Fare documents by agency IDs.
13
- *
14
- * @param ids - The agency IDs to search for
15
- // * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- code: string;
28
- name: string;
29
- agency_ids: string[];
30
- currency_type: "EUR";
31
- payment_method: "0" | "1";
32
- price: number;
33
- transfers: "0" | "1" | "2" | "unlimited";
34
- updated_by?: string | undefined;
35
- }>[]>;
36
- protected getCollectionIndexes(): IndexDescription[];
37
- protected getCollectionName(): string;
38
- protected getEnvName(): string;
39
- }
40
- export declare const fares: FaresClass;
41
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateFareSchema, UpdateFareSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class FaresClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateFareSchema;
9
- updateSchema = UpdateFareSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!FaresClass._instance) {
15
- const instance = new FaresClass();
16
- await instance.connect();
17
- FaresClass._instance = instance;
18
- }
19
- return FaresClass._instance;
20
- }
21
- /**
22
- * Finds Fare documents by agency IDs.
23
- *
24
- * @param ids - The agency IDs to search for
25
- // * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByAgencyIds(ids) {
28
- return this.mongoCollection.find({ agency_ids: { $in: ids } }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'fares';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const fares = asyncSingletonProxy(FaresClass);
@@ -1,4 +0,0 @@
1
- export * from './lines.js';
2
- export * from './patterns.js';
3
- export * from './routes.js';
4
- export * from './typologies.js';
@@ -1,4 +0,0 @@
1
- export * from './lines.js';
2
- export * from './patterns.js';
3
- export * from './routes.js';
4
- export * from './typologies.js';
@@ -1,44 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreateLineDto, type Line, type UpdateLineDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class LinesClass extends MongoCollectionClass<Line, CreateLineDto, UpdateLineDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<LinesClass>;
11
- /**
12
- * Finds Line documents by agency IDs.
13
- *
14
- * @param ids - The agency IDs to search for
15
- // * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- code: string;
28
- name: string;
29
- agency_id: string;
30
- interchange: "0" | "1" | "2";
31
- is_circular_line: boolean;
32
- is_school_line: boolean;
33
- onboard_fare_ids: string[] | null;
34
- prepaid_fare_id: string | null;
35
- transport_type: "ferry" | "subway" | "aerial_lift" | "bus" | "cable_tram" | "funicular" | "monorail" | "rail" | "tram" | "trolleybus";
36
- typology: string | null;
37
- updated_by?: string | undefined;
38
- }>[]>;
39
- protected getCollectionIndexes(): IndexDescription[];
40
- protected getCollectionName(): string;
41
- protected getEnvName(): string;
42
- }
43
- export declare const lines: LinesClass;
44
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateLineSchema, UpdateLineSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class LinesClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateLineSchema;
9
- updateSchema = UpdateLineSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!LinesClass._instance) {
15
- const instance = new LinesClass();
16
- await instance.connect();
17
- LinesClass._instance = instance;
18
- }
19
- return LinesClass._instance;
20
- }
21
- /**
22
- * Finds Line documents by agency IDs.
23
- *
24
- * @param ids - The agency IDs to search for
25
- // * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByAgencyIds(ids) {
28
- return this.mongoCollection.find({ agency_id: { $in: ids } }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'lines';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const lines = asyncSingletonProxy(LinesClass);
@@ -1,205 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreatePatternDto, type Pattern, type UpdatePatternDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class PatternsClass extends MongoCollectionClass<Pattern, CreatePatternDto, UpdatePatternDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<PatternsClass>;
11
- /**
12
- * Finds Pattern documents by line ID.
13
- *
14
- * @param lineId - The line ID to search for
15
- * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByLineId(lineId: string): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- code: string;
28
- rules: ({
29
- _id: string;
30
- kind: "manual";
31
- operating_mode: "exclude" | "include";
32
- timepoints: (string & z.BRAND<"HHMM">)[];
33
- year_period_ids: string[];
34
- name?: string | undefined;
35
- event_id?: string | undefined;
36
- months?: (1 | 2 | 12 | 10 | 11 | 4 | 3 | 8 | 5 | 6 | 7 | 9)[] | undefined;
37
- weekdays?: (1 | 2 | 4 | 3 | 5 | 6 | 7)[] | undefined;
38
- } | {
39
- event: {
40
- title: string;
41
- id: string;
42
- };
43
- dates: import("@tmlmobilidade/types").OperationalDate[];
44
- kind: "event_restriction";
45
- lines_mode: "exclude" | "include" | "all";
46
- all_day: boolean;
47
- end_time: string & z.BRAND<"HHMM">;
48
- start_time: string & z.BRAND<"HHMM">;
49
- _id?: string | undefined;
50
- name?: string | undefined;
51
- timepoints?: (string & z.BRAND<"HHMM">)[] | undefined;
52
- lines_to_exclude?: string[] | undefined;
53
- lines_to_include?: string[] | undefined;
54
- } | {
55
- event: {
56
- title: string;
57
- id: string;
58
- };
59
- dates: import("@tmlmobilidade/types").OperationalDate[];
60
- kind: "event_replacement";
61
- weekdays: (1 | 2 | 4 | 3 | 5 | 6 | 7)[];
62
- year_period_ids: string[];
63
- lines_mode: "exclude" | "include" | "all";
64
- _id?: string | undefined;
65
- name?: string | undefined;
66
- timepoints?: (string & z.BRAND<"HHMM">)[] | undefined;
67
- lines_to_exclude?: string[] | undefined;
68
- lines_to_include?: string[] | undefined;
69
- same_weekday?: boolean | undefined;
70
- })[];
71
- headsign: string;
72
- line_id: string;
73
- route_id: string;
74
- comments: ({
75
- message: string;
76
- type: "note";
77
- created_at: number & {
78
- __brand: "UnixTimestamp";
79
- };
80
- created_by: string | null;
81
- updated_at: number & {
82
- __brand: "UnixTimestamp";
83
- };
84
- _id?: string | undefined;
85
- updated_by?: string | undefined;
86
- } | {
87
- type: "field_changed";
88
- created_at: number & {
89
- __brand: "UnixTimestamp";
90
- };
91
- created_by: string | null;
92
- updated_at: number & {
93
- __brand: "UnixTimestamp";
94
- };
95
- field: string;
96
- _id?: string | undefined;
97
- updated_by?: string | undefined;
98
- curr_value?: any;
99
- prev_value?: any;
100
- metadata?: {
101
- changes?: {
102
- field: string;
103
- curr_value?: any;
104
- prev_value?: any;
105
- }[] | undefined;
106
- } | null | undefined;
107
- } | {
108
- type: "crud";
109
- created_at: number & {
110
- __brand: "UnixTimestamp";
111
- };
112
- created_by: string | null;
113
- updated_at: number & {
114
- __brand: "UnixTimestamp";
115
- };
116
- action: "create" | "update" | "delete" | "archive" | "restore";
117
- _id?: string | undefined;
118
- updated_by?: string | undefined;
119
- })[];
120
- destination: string;
121
- direction: "outbound" | "inbound";
122
- origin: string;
123
- updated_by?: string | undefined;
124
- path?: {
125
- _id: string;
126
- stop_id: number;
127
- timepoint: boolean;
128
- allow_drop_off: boolean;
129
- allow_pickup: boolean;
130
- distance_delta: number | null;
131
- zones?: string[] | undefined;
132
- }[] | undefined;
133
- shape?: {
134
- geojson: {
135
- type: string;
136
- geometry: {
137
- type: string;
138
- coordinates: number[][];
139
- };
140
- properties?: {} | undefined;
141
- };
142
- extension: number;
143
- encoded_polyline?: string | undefined;
144
- anchors?: {
145
- _id: string;
146
- type: "via" | "through";
147
- after_stop_id: number;
148
- before_stop_id: number;
149
- lat: number;
150
- lon: number;
151
- sequence: number;
152
- }[] | undefined;
153
- legs?: {
154
- geojson: {
155
- type: string;
156
- properties: {
157
- distance: number;
158
- duration: number;
159
- from_index: number;
160
- to_index: number;
161
- };
162
- geometry: {
163
- type: string;
164
- coordinates: number[][];
165
- };
166
- };
167
- distance: number;
168
- duration: number;
169
- from_index: number;
170
- geometry: [number, number][];
171
- to_index: number;
172
- encoded_polyline?: string | undefined;
173
- }[] | undefined;
174
- } | undefined;
175
- parameters?: ({
176
- path: {
177
- stop_id: number;
178
- avg_speed: number;
179
- dwell_time: number;
180
- }[];
181
- kind: "default";
182
- _id?: string | undefined;
183
- name?: string | undefined;
184
- vehicle_type?: string | undefined;
185
- } | {
186
- path: {
187
- stop_id: number;
188
- avg_speed: number;
189
- dwell_time: number;
190
- }[];
191
- kind: "override";
192
- weekdays: (1 | 2 | 4 | 3 | 5 | 6 | 7)[];
193
- year_period_ids: string[];
194
- _id?: string | undefined;
195
- name?: string | undefined;
196
- vehicle_type?: string | undefined;
197
- day_periods?: ("PPM" | "CD" | "PPT" | "N" | "M")[] | undefined;
198
- })[] | undefined;
199
- }>[]>;
200
- protected getCollectionIndexes(): IndexDescription[];
201
- protected getCollectionName(): string;
202
- protected getEnvName(): string;
203
- }
204
- export declare const patterns: PatternsClass;
205
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreatePatternSchema, UpdatePatternSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class PatternsClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreatePatternSchema;
9
- updateSchema = UpdatePatternSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!PatternsClass._instance) {
15
- const instance = new PatternsClass();
16
- await instance.connect();
17
- PatternsClass._instance = instance;
18
- }
19
- return PatternsClass._instance;
20
- }
21
- /**
22
- * Finds Pattern documents by line ID.
23
- *
24
- * @param lineId - The line ID to search for
25
- * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByLineId(lineId) {
28
- return this.mongoCollection.find({ line_id: lineId }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'patterns';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const patterns = asyncSingletonProxy(PatternsClass);
@@ -1,45 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreateRouteDto, type Route, type UpdateRouteDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class RoutesClass extends MongoCollectionClass<Route, CreateRouteDto, UpdateRouteDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<RoutesClass>;
11
- /**
12
- * Finds Route documents by line ID.
13
- *
14
- * @param lineId - The line ID to search for
15
- * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByLineId(lineId: string): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- code: string;
28
- name: string;
29
- line_id: string;
30
- path_type: "partial" | "base" | "variant";
31
- updated_by?: string | undefined;
32
- patterns?: {
33
- _id: string;
34
- code: string;
35
- headsign: string;
36
- line_id: string;
37
- route_id: string;
38
- }[] | undefined;
39
- }>[]>;
40
- protected getCollectionIndexes(): IndexDescription[];
41
- protected getCollectionName(): string;
42
- protected getEnvName(): string;
43
- }
44
- export declare const routes: RoutesClass;
45
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateRouteSchema, UpdateRouteSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class RoutesClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateRouteSchema;
9
- updateSchema = UpdateRouteSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!RoutesClass._instance) {
15
- const instance = new RoutesClass();
16
- await instance.connect();
17
- RoutesClass._instance = instance;
18
- }
19
- return RoutesClass._instance;
20
- }
21
- /**
22
- * Finds Route documents by line ID.
23
- *
24
- * @param lineId - The line ID to search for
25
- * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByLineId(lineId) {
28
- return this.mongoCollection.find({ line_id: lineId }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'routes';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const routes = asyncSingletonProxy(RoutesClass);
@@ -1,41 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreateTypologyDto, type Typology, type UpdateTypologyDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class TypologiesClass extends MongoCollectionClass<Typology, CreateTypologyDto, UpdateTypologyDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<TypologiesClass>;
11
- /**
12
- * Finds Typology documents by agency IDs.
13
- *
14
- * @param ids - The agency IDs to search for
15
- // * @returns A promise that resolves to an array of matching documents
16
- */
17
- findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{
18
- _id: string;
19
- created_at: number & {
20
- __brand: "UnixTimestamp";
21
- };
22
- created_by: string | null;
23
- is_locked: boolean;
24
- updated_at: number & {
25
- __brand: "UnixTimestamp";
26
- };
27
- code: string;
28
- name: string;
29
- agency_ids: string[];
30
- color: string;
31
- default_onboard_fare_ids: string[] | null;
32
- default_prepaid_fare_id: string | null;
33
- text_color: string;
34
- updated_by?: string | undefined;
35
- }>[]>;
36
- protected getCollectionIndexes(): IndexDescription[];
37
- protected getCollectionName(): string;
38
- protected getEnvName(): string;
39
- }
40
- export declare const typologies: TypologiesClass;
41
- export {};
@@ -1,41 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateTypologySchema, UpdateTypologySchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class TypologiesClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateTypologySchema;
9
- updateSchema = UpdateTypologySchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!TypologiesClass._instance) {
15
- const instance = new TypologiesClass();
16
- await instance.connect();
17
- TypologiesClass._instance = instance;
18
- }
19
- return TypologiesClass._instance;
20
- }
21
- /**
22
- * Finds Typology documents by agency IDs.
23
- *
24
- * @param ids - The agency IDs to search for
25
- // * @returns A promise that resolves to an array of matching documents
26
- */
27
- async findByAgencyIds(ids) {
28
- return this.mongoCollection.find({ agency_ids: { $in: ids } }).toArray();
29
- }
30
- getCollectionIndexes() {
31
- return [];
32
- }
33
- getCollectionName() {
34
- return 'typologies';
35
- }
36
- getEnvName() {
37
- return 'DATABASE_URI';
38
- }
39
- }
40
- /* * */
41
- export const typologies = asyncSingletonProxy(TypologiesClass);
@@ -1,149 +0,0 @@
1
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
- import { type CreateZoneDto, type UpdateZoneDto, type Zone } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class ZonesClass extends MongoCollectionClass<Zone, CreateZoneDto, UpdateZoneDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<ZonesClass>;
11
- /**
12
- * Finds a zone document by its code.
13
- * @param code The code of the zone to find
14
- * @returns A promise that resolves to the matching zone document or null if not found
15
- */
16
- findByCode(code: string): Promise<import("mongodb").WithId<{
17
- _id: string;
18
- created_at: number & {
19
- __brand: "UnixTimestamp";
20
- };
21
- created_by: string | null;
22
- is_locked: boolean;
23
- updated_at: number & {
24
- __brand: "UnixTimestamp";
25
- };
26
- code: string;
27
- name: string;
28
- agency_ids: string[];
29
- geojson: {
30
- type: "Feature";
31
- geometry: {
32
- type: "Polygon";
33
- coordinates: number[][][];
34
- } | {
35
- type: "MultiPolygon";
36
- coordinates: number[][][][];
37
- };
38
- properties?: Record<string, any> | null | undefined;
39
- } | {
40
- type: "FeatureCollection";
41
- features: {
42
- type: "Feature";
43
- geometry: {
44
- type: "Polygon";
45
- coordinates: number[][][];
46
- } | {
47
- type: "MultiPolygon";
48
- coordinates: number[][][][];
49
- };
50
- properties?: Record<string, any> | null | undefined;
51
- }[];
52
- } | null;
53
- updated_by?: string | undefined;
54
- }>>;
55
- /**
56
- * Finds a zone document by its name.
57
- * @param name The name of the zone to find
58
- * @returns A promise that resolves to the matching zone document or null if not found
59
- */
60
- findByName(name: string): Promise<import("mongodb").WithId<{
61
- _id: string;
62
- created_at: number & {
63
- __brand: "UnixTimestamp";
64
- };
65
- created_by: string | null;
66
- is_locked: boolean;
67
- updated_at: number & {
68
- __brand: "UnixTimestamp";
69
- };
70
- code: string;
71
- name: string;
72
- agency_ids: string[];
73
- geojson: {
74
- type: "Feature";
75
- geometry: {
76
- type: "Polygon";
77
- coordinates: number[][][];
78
- } | {
79
- type: "MultiPolygon";
80
- coordinates: number[][][][];
81
- };
82
- properties?: Record<string, any> | null | undefined;
83
- } | {
84
- type: "FeatureCollection";
85
- features: {
86
- type: "Feature";
87
- geometry: {
88
- type: "Polygon";
89
- coordinates: number[][][];
90
- } | {
91
- type: "MultiPolygon";
92
- coordinates: number[][][][];
93
- };
94
- properties?: Record<string, any> | null | undefined;
95
- }[];
96
- } | null;
97
- updated_by?: string | undefined;
98
- }>>;
99
- /**
100
- * Updates a zone document by its code.
101
- * @param code The code of the zone to update.
102
- * @param updateFields The fields to update in the zone document.
103
- * @returns A promise that resolves to the result of the update operation.
104
- */
105
- updateByCode(code: string, updateFields: Partial<Zone>): Promise<import("mongodb").UpdateResult<{
106
- _id: string;
107
- created_at: number & {
108
- __brand: "UnixTimestamp";
109
- };
110
- created_by: string | null;
111
- is_locked: boolean;
112
- updated_at: number & {
113
- __brand: "UnixTimestamp";
114
- };
115
- code: string;
116
- name: string;
117
- agency_ids: string[];
118
- geojson: {
119
- type: "Feature";
120
- geometry: {
121
- type: "Polygon";
122
- coordinates: number[][][];
123
- } | {
124
- type: "MultiPolygon";
125
- coordinates: number[][][][];
126
- };
127
- properties?: Record<string, any> | null | undefined;
128
- } | {
129
- type: "FeatureCollection";
130
- features: {
131
- type: "Feature";
132
- geometry: {
133
- type: "Polygon";
134
- coordinates: number[][][];
135
- } | {
136
- type: "MultiPolygon";
137
- coordinates: number[][][][];
138
- };
139
- properties?: Record<string, any> | null | undefined;
140
- }[];
141
- } | null;
142
- updated_by?: string | undefined;
143
- }>>;
144
- protected getCollectionIndexes(): IndexDescription[];
145
- protected getCollectionName(): string;
146
- protected getEnvName(): string;
147
- }
148
- export declare const zones: ZonesClass;
149
- export {};
@@ -1,59 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateZoneSchema, UpdateZoneSchema } from '@tmlmobilidade/types';
4
- import { asyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class ZonesClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = CreateZoneSchema;
9
- updateSchema = UpdateZoneSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!ZonesClass._instance) {
15
- const instance = new ZonesClass();
16
- await instance.connect();
17
- ZonesClass._instance = instance;
18
- }
19
- return ZonesClass._instance;
20
- }
21
- /**
22
- * Finds a zone document by its code.
23
- * @param code The code of the zone to find
24
- * @returns A promise that resolves to the matching zone document or null if not found
25
- */
26
- async findByCode(code) {
27
- return this.mongoCollection.findOne({ code });
28
- }
29
- /**
30
- * Finds a zone document by its name.
31
- * @param name The name of the zone to find
32
- * @returns A promise that resolves to the matching zone document or null if not found
33
- */
34
- async findByName(name) {
35
- return this.mongoCollection.findOne({ name });
36
- }
37
- /**
38
- * Updates a zone document by its code.
39
- * @param code The code of the zone to update.
40
- * @param updateFields The fields to update in the zone document.
41
- * @returns A promise that resolves to the result of the update operation.
42
- */
43
- async updateByCode(code, updateFields) {
44
- return this.mongoCollection.updateOne({ code }, { $set: updateFields });
45
- }
46
- getCollectionIndexes() {
47
- return [
48
- { background: true, key: { code: 1 }, unique: true },
49
- ];
50
- }
51
- getCollectionName() {
52
- return 'zones';
53
- }
54
- getEnvName() {
55
- return 'DATABASE_URI';
56
- }
57
- }
58
- /* * */
59
- export const zones = asyncSingletonProxy(ZonesClass);