@entity-access/entity-access 1.2.29 → 1.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/common/CIMap.d.ts +16 -0
- package/dist/common/CIMap.d.ts.map +1 -0
- package/dist/common/CustomEvent.d.ts +12 -0
- package/dist/common/CustomEvent.d.ts.map +1 -0
- package/dist/common/EALogger.d.ts +4 -0
- package/dist/common/EALogger.d.ts.map +1 -0
- package/dist/common/EntityAccessError.d.ts +7 -0
- package/dist/common/EntityAccessError.d.ts.map +1 -0
- package/dist/common/ErrorModel.d.ts +14 -0
- package/dist/common/ErrorModel.d.ts.map +1 -0
- package/dist/common/EventSet.d.ts +20 -0
- package/dist/common/EventSet.d.ts.map +1 -0
- package/dist/common/IColumnSchema.d.ts +21 -0
- package/dist/common/IColumnSchema.d.ts.map +1 -0
- package/dist/common/IDisposable.d.ts +7 -0
- package/dist/common/IDisposable.d.ts.map +1 -0
- package/dist/common/ImmutableObject.d.ts +5 -0
- package/dist/common/ImmutableObject.d.ts.map +1 -0
- package/dist/common/JsonGenerator.d.ts +11 -0
- package/dist/common/JsonGenerator.d.ts.map +1 -0
- package/dist/common/Logger.d.ts +33 -0
- package/dist/common/Logger.d.ts.map +1 -0
- package/dist/common/ObjectPool.d.ts +61 -0
- package/dist/common/ObjectPool.d.ts.map +1 -0
- package/dist/common/TypeInfo.d.ts +4 -0
- package/dist/common/TypeInfo.d.ts.map +1 -0
- package/dist/common/cache/InstanceCache.d.ts +2 -0
- package/dist/common/cache/InstanceCache.d.ts.map +1 -0
- package/dist/common/cache/TimedCache.d.ts +33 -0
- package/dist/common/cache/TimedCache.d.ts.map +1 -0
- package/dist/common/cloner.d.ts +4 -0
- package/dist/common/cloner.d.ts.map +1 -0
- package/dist/common/sleep.d.ts +2 -0
- package/dist/common/sleep.d.ts.map +1 -0
- package/dist/common/symbols/symbols.d.ts +8 -0
- package/dist/common/symbols/symbols.d.ts.map +1 -0
- package/dist/common/usingAsync.d.ts +15 -0
- package/dist/common/usingAsync.d.ts.map +1 -0
- package/dist/compiler/ISqlHelpers.d.ts +12 -0
- package/dist/compiler/ISqlHelpers.d.ts.map +1 -0
- package/dist/compiler/NamingConventions.d.ts +8 -0
- package/dist/compiler/NamingConventions.d.ts.map +1 -0
- package/dist/compiler/QueryCompiler.d.ts +45 -0
- package/dist/compiler/QueryCompiler.d.ts.map +1 -0
- package/dist/compiler/RawQuery.d.ts +9 -0
- package/dist/compiler/RawQuery.d.ts.map +1 -0
- package/dist/compiler/postgres/PostgreSqlMethodTransformer.d.ts +4 -0
- package/dist/compiler/postgres/PostgreSqlMethodTransformer.d.ts.map +1 -0
- package/dist/compiler/sql-server/SqlServerSqlMethodTransformer.d.ts +4 -0
- package/dist/compiler/sql-server/SqlServerSqlMethodTransformer.d.ts.map +1 -0
- package/dist/decorators/CheckConstraint.d.ts +4 -0
- package/dist/decorators/CheckConstraint.d.ts.map +1 -0
- package/dist/decorators/Column.d.ts +10 -0
- package/dist/decorators/Column.d.ts.map +1 -0
- package/dist/decorators/ForeignKey.d.ts +10 -0
- package/dist/decorators/ForeignKey.d.ts.map +1 -0
- package/dist/decorators/ICheckConstraint.d.ts +5 -0
- package/dist/decorators/ICheckConstraint.d.ts.map +1 -0
- package/dist/decorators/IClassOf.d.ts +3 -0
- package/dist/decorators/IClassOf.d.ts.map +1 -0
- package/dist/decorators/IColumn.d.ts +87 -0
- package/dist/decorators/IColumn.d.ts.map +1 -0
- package/dist/decorators/IForeignKeyConstraint.d.ts +12 -0
- package/dist/decorators/IForeignKeyConstraint.d.ts.map +1 -0
- package/dist/decorators/IIndex.d.ts +30 -0
- package/dist/decorators/IIndex.d.ts.map +1 -0
- package/dist/decorators/ISqlType.d.ts +61 -0
- package/dist/decorators/ISqlType.d.ts.map +1 -0
- package/dist/decorators/Index.d.ts +4 -0
- package/dist/decorators/Index.d.ts.map +1 -0
- package/dist/decorators/Relate.d.ts +37 -0
- package/dist/decorators/Relate.d.ts.map +1 -0
- package/dist/decorators/SchemaRegistry.d.ts +9 -0
- package/dist/decorators/SchemaRegistry.d.ts.map +1 -0
- package/dist/decorators/Table.d.ts +9 -0
- package/dist/decorators/Table.d.ts.map +1 -0
- package/dist/decorators/parser/NameParser.d.ts +4 -0
- package/dist/decorators/parser/NameParser.d.ts.map +1 -0
- package/dist/di/di.d.ts +49 -0
- package/dist/di/di.d.ts.map +1 -0
- package/dist/drivers/base/BaseDriver.d.ts +134 -0
- package/dist/drivers/base/BaseDriver.d.ts.map +1 -0
- package/dist/drivers/base/ExistingSchema.d.ts +14 -0
- package/dist/drivers/base/ExistingSchema.d.ts.map +1 -0
- package/dist/drivers/base/ReaderQueue.d.ts +17 -0
- package/dist/drivers/base/ReaderQueue.d.ts.map +1 -0
- package/dist/drivers/postgres/PostgreSqlDriver.d.ts +29 -0
- package/dist/drivers/postgres/PostgreSqlDriver.d.ts.map +1 -0
- package/dist/drivers/sql-server/ExpressionToSqlServer.d.ts +14 -0
- package/dist/drivers/sql-server/ExpressionToSqlServer.d.ts.map +1 -0
- package/dist/drivers/sql-server/SqlServerDriver.d.ts +30 -0
- package/dist/drivers/sql-server/SqlServerDriver.d.ts.map +1 -0
- package/dist/drivers/sql-server/SqlServerLiteral.d.ts +5 -0
- package/dist/drivers/sql-server/SqlServerLiteral.d.ts.map +1 -0
- package/dist/drivers/sql-server/SqlServerQueryCompiler.d.ts +5 -0
- package/dist/drivers/sql-server/SqlServerQueryCompiler.d.ts.map +1 -0
- package/dist/entity-query/EntityType.d.ts +78 -0
- package/dist/entity-query/EntityType.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/migrations/Migrations.d.ts +44 -0
- package/dist/migrations/Migrations.d.ts.map +1 -0
- package/dist/migrations/postgres/PostgresAutomaticMigrations.d.ts +19 -0
- package/dist/migrations/postgres/PostgresAutomaticMigrations.d.ts.map +1 -0
- package/dist/migrations/postgres/PostgresMigrations.d.ts +11 -0
- package/dist/migrations/postgres/PostgresMigrations.d.ts.map +1 -0
- package/dist/migrations/sql-server/SqlServerAutomaticMigrations.d.ts +19 -0
- package/dist/migrations/sql-server/SqlServerAutomaticMigrations.d.ts.map +1 -0
- package/dist/migrations/sql-server/SqlServerMigrations.d.ts +12 -0
- package/dist/migrations/sql-server/SqlServerMigrations.d.ts.map +1 -0
- package/dist/model/EntityContext.d.ts +36 -0
- package/dist/model/EntityContext.d.ts.map +1 -0
- package/dist/model/EntityModel.d.ts +13 -0
- package/dist/model/EntityModel.d.ts.map +1 -0
- package/dist/model/EntityQuery.d.ts +64 -0
- package/dist/model/EntityQuery.d.ts.map +1 -0
- package/dist/model/EntitySource.d.ts +86 -0
- package/dist/model/EntitySource.d.ts.map +1 -0
- package/dist/model/IFilterWithParameter.d.ts +80 -0
- package/dist/model/IFilterWithParameter.d.ts.map +1 -0
- package/dist/model/SourceExpression.d.ts +2 -0
- package/dist/model/SourceExpression.d.ts.map +1 -0
- package/dist/model/changes/ChangeEntry.d.ts +61 -0
- package/dist/model/changes/ChangeEntry.d.ts.map +1 -0
- package/dist/model/changes/ChangeSet.d.ts +31 -0
- package/dist/model/changes/ChangeSet.d.ts.map +1 -0
- package/dist/model/events/ContextEvents.d.ts +11 -0
- package/dist/model/events/ContextEvents.d.ts.map +1 -0
- package/dist/model/events/EntityEvents.d.ts +39 -0
- package/dist/model/events/EntityEvents.d.ts.map +1 -0
- package/dist/model/events/FilteredExpression.d.ts +11 -0
- package/dist/model/events/FilteredExpression.d.ts.map +1 -0
- package/dist/model/identity/IdentityMap.d.ts +23 -0
- package/dist/model/identity/IdentityMap.d.ts.map +1 -0
- package/dist/model/identity/IdentityService.d.ts +5 -0
- package/dist/model/identity/IdentityService.d.ts.map +1 -0
- package/dist/model/identity/RelationMapper.d.ts +11 -0
- package/dist/model/identity/RelationMapper.d.ts.map +1 -0
- package/dist/model/identity/SearchIndex.d.ts +17 -0
- package/dist/model/identity/SearchIndex.d.ts.map +1 -0
- package/dist/model/symbols.d.ts +2 -0
- package/dist/model/symbols.d.ts.map +1 -0
- package/dist/model/verification/VerificationSession.d.ts +27 -0
- package/dist/model/verification/VerificationSession.d.ts.map +1 -0
- package/dist/query/Query.d.ts +29 -0
- package/dist/query/Query.d.ts.map +1 -0
- package/dist/query/ast/DebugStringVisitor.d.ts +40 -0
- package/dist/query/ast/DebugStringVisitor.d.ts.map +1 -0
- package/dist/query/ast/ExpressionToSql.d.ts +67 -0
- package/dist/query/ast/ExpressionToSql.d.ts.map +1 -0
- package/dist/query/ast/Expressions.d.ts +255 -0
- package/dist/query/ast/Expressions.d.ts.map +1 -0
- package/dist/query/ast/IStringTransformer.d.ts +27 -0
- package/dist/query/ast/IStringTransformer.d.ts.map +1 -0
- package/dist/query/ast/ParameterScope.d.ts +25 -0
- package/dist/query/ast/ParameterScope.d.ts.map +1 -0
- package/dist/query/ast/ReplaceParameter.d.ts +6 -0
- package/dist/query/ast/ReplaceParameter.d.ts.map +1 -0
- package/dist/query/ast/SqlLiteral.d.ts +4 -0
- package/dist/query/ast/SqlLiteral.d.ts.map +1 -0
- package/dist/query/ast/Types.d.ts +2 -0
- package/dist/query/ast/Types.d.ts.map +1 -0
- package/dist/query/ast/Visitor.d.ts +40 -0
- package/dist/query/ast/Visitor.d.ts.map +1 -0
- package/dist/query/expander/QueryExpander.d.ts +12 -0
- package/dist/query/expander/QueryExpander.d.ts.map +1 -0
- package/dist/query/parser/ArrowToExpression.d.ts +58 -0
- package/dist/query/parser/ArrowToExpression.d.ts.map +1 -0
- package/dist/query/parser/BabelVisitor.d.ts +24 -0
- package/dist/query/parser/BabelVisitor.d.ts.map +1 -0
- package/dist/query/parser/NotSupportedError.d.ts +5 -0
- package/dist/query/parser/NotSupportedError.d.ts.map +1 -0
- package/dist/query/parser/Restructure.d.ts +20 -0
- package/dist/query/parser/Restructure.d.ts.map +1 -0
- package/dist/query/parser/TransformVisitor.d.ts +25 -0
- package/dist/query/parser/TransformVisitor.d.ts.map +1 -0
- package/dist/sql/ISql.d.ts +160 -0
- package/dist/sql/ISql.d.ts.map +1 -0
- package/dist/sql/Sql.d.ts +4 -0
- package/dist/sql/Sql.d.ts.map +1 -0
- package/dist/types/DateTime.d.ts +168 -0
- package/dist/types/DateTime.d.ts.map +1 -0
- package/dist/types/TimeSpan.d.ts +40 -0
- package/dist/types/TimeSpan.d.ts.map +1 -0
- package/dist/workflows/ActivitySuspendedError.d.ts +6 -0
- package/dist/workflows/ActivitySuspendedError.d.ts.map +1 -0
- package/dist/workflows/Waiter.d.ts +10 -0
- package/dist/workflows/Waiter.d.ts.map +1 -0
- package/dist/workflows/Workflow.d.ts +47 -0
- package/dist/workflows/Workflow.d.ts.map +1 -0
- package/dist/workflows/WorkflowClock.d.ts +5 -0
- package/dist/workflows/WorkflowClock.d.ts.map +1 -0
- package/dist/workflows/WorkflowContext.d.ts +52 -0
- package/dist/workflows/WorkflowContext.d.ts.map +1 -0
- package/dist/workflows/WorkflowDbContext.d.ts +32 -0
- package/dist/workflows/WorkflowDbContext.d.ts.map +1 -0
- package/dist/workflows/WorkflowRegistry.d.ts +13 -0
- package/dist/workflows/WorkflowRegistry.d.ts.map +1 -0
- package/dist/workflows/WorkflowStorage.d.ts +72 -0
- package/dist/workflows/WorkflowStorage.d.ts.map +1 -0
- package/dist/workflows/WorkflowTask.d.ts +13 -0
- package/dist/workflows/WorkflowTask.d.ts.map +1 -0
- package/package.json +1 -1
- package/tsconfig.json +2 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import TimeSpan from "./TimeSpan.js";
|
|
2
|
+
/**
|
|
3
|
+
* DateTime differs from Date in following cases,
|
|
4
|
+
* 1. DateTime is immutable, however underlying object is Date
|
|
5
|
+
* but all methods specific to DateTime are immutable
|
|
6
|
+
* 2. DateTime has readonly properties for `day, month, year etc`
|
|
7
|
+
* 3. DateTime is derived from Date so passing DateTime to existing
|
|
8
|
+
* code will not change anything, however intellisense does not display
|
|
9
|
+
* any methods of Date unless you explicity cast as Date, but instanceof
|
|
10
|
+
* works correctly
|
|
11
|
+
* 4. DateTime does not modify underlying Date prototype or add any methods to it
|
|
12
|
+
* ``` typescript
|
|
13
|
+
* DateTime dt = DateTime.now();
|
|
14
|
+
* (dt instanceof Date) // is true
|
|
15
|
+
* (dt instanceof DateTime) // is also true
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export default class DateTime {
|
|
19
|
+
/**
|
|
20
|
+
* Current date without time
|
|
21
|
+
*/
|
|
22
|
+
static get today(): DateTime;
|
|
23
|
+
/**
|
|
24
|
+
* DateTime at right now
|
|
25
|
+
*/
|
|
26
|
+
static get now(): DateTime;
|
|
27
|
+
/**
|
|
28
|
+
* Returns DateTime new instance from Date or String, if d is DateTime already
|
|
29
|
+
* it will return the d.
|
|
30
|
+
* @param d Date | DateTime | string
|
|
31
|
+
* @returns DateTime
|
|
32
|
+
*/
|
|
33
|
+
static from(d: Date | DateTime | string): DateTime;
|
|
34
|
+
static parse(s: string): DateTime;
|
|
35
|
+
/**
|
|
36
|
+
* Converts a date and time to a string by using the current or specified locale.
|
|
37
|
+
* @param locales A locale string or array of locale strings that contain one or more language
|
|
38
|
+
* or locale tags. If you include more than one locale string, list them in descending order of
|
|
39
|
+
* priority so that the first entry is the preferred locale. If you omit this parameter,
|
|
40
|
+
* the default locale of the JavaScript runtime is used.
|
|
41
|
+
* @param options An object that contains one or more properties that specify comparison options.
|
|
42
|
+
*/
|
|
43
|
+
toLocaleString: (locales?: string | string[], options?: Intl.DateTimeFormatOptions) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Converts a date to a string by using the current or specified locale.
|
|
46
|
+
* @param locales A locale string or array of locale strings that contain one or more language
|
|
47
|
+
* or locale tags. If you include more than one locale string, list them in descending order
|
|
48
|
+
* of priority so that the first entry is the preferred locale. If you omit this parameter,
|
|
49
|
+
* the default locale of the JavaScript runtime is used.
|
|
50
|
+
* @param options An object that contains one or more properties that specify comparison options.
|
|
51
|
+
*/
|
|
52
|
+
toLocaleDateString: (locales?: string | string[], options?: Intl.DateTimeFormatOptions) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Converts a time to a string by using the current or specified locale.
|
|
55
|
+
* @param locales A locale string or array of locale strings that contain one or more language
|
|
56
|
+
* or locale tags. If you include more than one locale string, list them in descending order of
|
|
57
|
+
* priority so that the first entry is the preferred locale. If you omit this parameter,
|
|
58
|
+
* the default locale of the JavaScript runtime is used.
|
|
59
|
+
* @param options An object that contains one or more properties that specify comparison options.
|
|
60
|
+
*/
|
|
61
|
+
toLocaleTimeString: (locales?: string | string[], options?: Intl.DateTimeFormatOptions) => string;
|
|
62
|
+
/** Returns a date converted to a string using Universal Coordinated Time (UTC). */
|
|
63
|
+
toUTCString: () => string;
|
|
64
|
+
/** Returns a date as a string value in ISO format. */
|
|
65
|
+
toISOString: () => string;
|
|
66
|
+
/** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object
|
|
67
|
+
* Notation (JSON) serialization.
|
|
68
|
+
*/
|
|
69
|
+
toJSON: (key?: any) => string;
|
|
70
|
+
toTimeString: () => string;
|
|
71
|
+
toDateString: () => string;
|
|
72
|
+
/** Day of month */
|
|
73
|
+
get day(): number;
|
|
74
|
+
/** Day of week */
|
|
75
|
+
get dayOfWeek(): number;
|
|
76
|
+
/**
|
|
77
|
+
* Current month, 0 is January
|
|
78
|
+
*/
|
|
79
|
+
get month(): number;
|
|
80
|
+
/**
|
|
81
|
+
* Current full year
|
|
82
|
+
*/
|
|
83
|
+
get year(): number;
|
|
84
|
+
/**
|
|
85
|
+
* Current hour of the day
|
|
86
|
+
*/
|
|
87
|
+
get hour(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Current minute of the hour
|
|
90
|
+
*/
|
|
91
|
+
get minute(): number;
|
|
92
|
+
/**
|
|
93
|
+
* Current second of the minute
|
|
94
|
+
*/
|
|
95
|
+
get second(): number;
|
|
96
|
+
get milliSecond(): number;
|
|
97
|
+
/**
|
|
98
|
+
* Timezone offset as TimeSpan
|
|
99
|
+
*/
|
|
100
|
+
get timeZoneOffset(): TimeSpan;
|
|
101
|
+
/**
|
|
102
|
+
* Milliseconds since EPOCH, ie total number of milliseconds
|
|
103
|
+
* of underlying Date object
|
|
104
|
+
*/
|
|
105
|
+
get msSinceEpoch(): number;
|
|
106
|
+
/**
|
|
107
|
+
* Strips time of the day and returns Date only
|
|
108
|
+
*/
|
|
109
|
+
get date(): DateTime;
|
|
110
|
+
/**
|
|
111
|
+
* Just for convenience, avoid using this, instead use methods of DateTime
|
|
112
|
+
* or suggest better method at our github repo
|
|
113
|
+
*/
|
|
114
|
+
get asJSDate(): Date;
|
|
115
|
+
/**
|
|
116
|
+
* Gets time of the day in TimeSpan format
|
|
117
|
+
*/
|
|
118
|
+
get time(): TimeSpan;
|
|
119
|
+
/**
|
|
120
|
+
* Creates new DateTime instance from given input,
|
|
121
|
+
* input parameters are exactly same as `Date`
|
|
122
|
+
*/
|
|
123
|
+
constructor(a?: any | string, b?: number, c?: number, d?: number, e?: number, f?: number, g?: number);
|
|
124
|
+
/**
|
|
125
|
+
* Adds date or TimeSpan to current date and returns a new DateTime
|
|
126
|
+
* @returns DateTime
|
|
127
|
+
* @param d DateTime or TimeSpan
|
|
128
|
+
*/
|
|
129
|
+
add(d: DateTime | TimeSpan): DateTime;
|
|
130
|
+
/**
|
|
131
|
+
* Adds (or removes -ve values specified) and returns newly created DateTime
|
|
132
|
+
* @returns DateTime
|
|
133
|
+
* @param days number of days
|
|
134
|
+
* @param hours number of hours
|
|
135
|
+
* @param minutes number of minutes
|
|
136
|
+
* @param seconds number of seconds
|
|
137
|
+
* @param milliseconds number of milliseconds
|
|
138
|
+
*/
|
|
139
|
+
add(days: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number): DateTime;
|
|
140
|
+
addMonths(m: number): DateTime;
|
|
141
|
+
addYears(y: number): DateTime;
|
|
142
|
+
addDays(day: number): DateTime;
|
|
143
|
+
addHours(h: number): DateTime;
|
|
144
|
+
addMinutes(m: number): DateTime;
|
|
145
|
+
addSeconds(m: number): DateTime;
|
|
146
|
+
/**
|
|
147
|
+
* Returns TimeSpan from subtracting rhs from this,
|
|
148
|
+
* `const ts = lhs.diff(rhs); // ts = lhs - rhs`
|
|
149
|
+
* @param rhs Right hand side
|
|
150
|
+
* @returns TimeSpan
|
|
151
|
+
*/
|
|
152
|
+
diff(rhs: Date | DateTime): TimeSpan;
|
|
153
|
+
equals(d: DateTime | Date): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Trims time part and compares the given dates
|
|
156
|
+
* @param d date to test
|
|
157
|
+
*/
|
|
158
|
+
dateEquals(d: DateTime | Date): boolean;
|
|
159
|
+
compare(d: DateTime | Date): number;
|
|
160
|
+
toRelativeString(dt?: DateTime | Date): string;
|
|
161
|
+
/**
|
|
162
|
+
* Returns number so that DateTime in logical comparison
|
|
163
|
+
* returns correct answer. Such as DateTime.from("2022-02-01") > DateTime.from("2021-02-01") returns true.
|
|
164
|
+
* @returns Milliseconds since EPOCH
|
|
165
|
+
*/
|
|
166
|
+
valueOf(): number;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=DateTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/types/DateTime.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,OAAO,QAAQ;IAEzB;;OAEG;IACH,WAAkB,KAAK,IAAI,QAAQ,CAGlC;IAED;;OAEG;IACH,WAAkB,GAAG,IAAI,QAAQ,CAEhC;IAED;;;;;OAKG;WACW,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ;WAa3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ;IAIxC;;;;;;;OAOG;IACI,cAAc,EAAE,CAAC,OAAO,CA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,OAAO;CAIjB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const msMinutes = 60000;
|
|
2
|
+
export declare const msSeconds = 1000;
|
|
3
|
+
export declare const msHours = 3600000;
|
|
4
|
+
export declare const msDays: number;
|
|
5
|
+
export default class TimeSpan {
|
|
6
|
+
static fromDays(n: number): TimeSpan;
|
|
7
|
+
static fromHours(n: number): TimeSpan;
|
|
8
|
+
static fromMinutes(n: number): TimeSpan;
|
|
9
|
+
static fromSeconds(n: number): TimeSpan;
|
|
10
|
+
static parse(text: string): TimeSpan;
|
|
11
|
+
get totalSeconds(): number;
|
|
12
|
+
get totalMinutes(): number;
|
|
13
|
+
get totalHours(): number;
|
|
14
|
+
get totalDays(): number;
|
|
15
|
+
get totalMilliseconds(): number;
|
|
16
|
+
get days(): number;
|
|
17
|
+
get hours(): number;
|
|
18
|
+
get minutes(): number;
|
|
19
|
+
get seconds(): number;
|
|
20
|
+
get milliseconds(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Duration is always positive TimeSpan
|
|
23
|
+
*/
|
|
24
|
+
get duration(): TimeSpan;
|
|
25
|
+
/**
|
|
26
|
+
* Removes days and only trims given TimeSpan to TimeOfDay
|
|
27
|
+
*/
|
|
28
|
+
get trimmedTime(): TimeSpan;
|
|
29
|
+
private msSinceEpoch;
|
|
30
|
+
constructor(ms: number);
|
|
31
|
+
constructor(days: number, hours: number, minutes?: number, seconds?: number, milliseconds?: number);
|
|
32
|
+
/**
|
|
33
|
+
* Format the TimeSpan as time format
|
|
34
|
+
* @param formatAs12 Display time as 12 hours with AM/PM (only if day is zero)
|
|
35
|
+
*/
|
|
36
|
+
toString(formatAs12?: boolean): string;
|
|
37
|
+
add(ts: TimeSpan): TimeSpan;
|
|
38
|
+
equals(ts: TimeSpan): boolean;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=TimeSpan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeSpan.d.ts","s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AAE,EAAE,QAAQ,GAAG,QAAQ;IAI3B,MAAM,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO;CAGvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivitySuspendedError.d.ts","sourceRoot":"","sources":["../../src/workflows/ActivitySuspendedError.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAG5C,qBAAa,sBAAuB,SAAQ,KAAK;IAE1B,GAAG,EAAE,QAAQ;gBAAb,GAAG,GAAE,QAA+B;CAI1D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default class Waiter {
|
|
2
|
+
private controller;
|
|
3
|
+
readonly signal: AbortSignal;
|
|
4
|
+
static create(): Waiter;
|
|
5
|
+
static releaseAll(): void;
|
|
6
|
+
private static set;
|
|
7
|
+
constructor(controller?: AbortController, signal?: AbortSignal);
|
|
8
|
+
[Symbol.dispose](): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Waiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Waiter.d.ts","sourceRoot":"","sources":["../../src/workflows/Waiter.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,MAAM;IAiBnB,OAAO,CAAC,UAAU;aACF,MAAM,EAAwB,WAAW;WAhB/C,MAAM;WAIN,UAAU;IAQxB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAqB;gBAG3B,UAAU,kBAAwB,EAC1B,MAAM,GAAwB,WAAW;IAI7D,CAAC,MAAM,CAAC,OAAO,CAAC;CAInB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IClassOf } from "../decorators/IClassOf.js";
|
|
2
|
+
import DateTime from "../types/DateTime.js";
|
|
3
|
+
import TimeSpan from "../types/TimeSpan.js";
|
|
4
|
+
import type WorkflowContext from "./WorkflowContext.js";
|
|
5
|
+
import type { IWorkflowThrottleGroup } from "./WorkflowStorage.js";
|
|
6
|
+
export declare function Activity(target: any, key: any): void;
|
|
7
|
+
export declare function UniqueActivity(target: any, key: any): void;
|
|
8
|
+
export default abstract class Workflow<TIn = any, TOut = any> {
|
|
9
|
+
protected context: WorkflowContext;
|
|
10
|
+
static taskGroup: any;
|
|
11
|
+
static taskGroups: string[];
|
|
12
|
+
/**
|
|
13
|
+
* If specified, all workflows in same sequence
|
|
14
|
+
* will executed sequentially in a single worker node
|
|
15
|
+
*/
|
|
16
|
+
readonly sequence: string;
|
|
17
|
+
readonly input: TIn;
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly eta: DateTime;
|
|
20
|
+
readonly currentTime: DateTime;
|
|
21
|
+
preserveTime: TimeSpan;
|
|
22
|
+
failedPreserveTime: TimeSpan;
|
|
23
|
+
constructor({ sequence, input, id, eta, currentTime }: {
|
|
24
|
+
sequence: string;
|
|
25
|
+
input: TIn;
|
|
26
|
+
id: string;
|
|
27
|
+
eta: DateTime;
|
|
28
|
+
currentTime: DateTime;
|
|
29
|
+
}, context: WorkflowContext);
|
|
30
|
+
abstract run(): Promise<TOut>;
|
|
31
|
+
protected extra<T extends {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}>(): Promise<T>;
|
|
34
|
+
protected setExtra<T extends {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}>(item: T): Promise<any>;
|
|
37
|
+
protected delay(ts: TimeSpan): Promise<string>;
|
|
38
|
+
protected waitForExternalEvent<T = any, TA extends string[] = string[]>(ts: TimeSpan, ...names: TA): Promise<{
|
|
39
|
+
name: TA[number] | null | undefined;
|
|
40
|
+
result: T;
|
|
41
|
+
}>;
|
|
42
|
+
protected runChild<TChildIn, TChildOut>(type: IClassOf<Workflow<TChildIn, TChildOut>>, input: TChildIn, throttle?: IWorkflowThrottleGroup, taskGroup?: string): Promise<TChildOut>;
|
|
43
|
+
protected all<T extends readonly unknown[] | []>(values: T): Promise<{
|
|
44
|
+
-readonly [P in keyof T]: Awaited<T[P]>;
|
|
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AM,aAEhB;CACJ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IClassOf } from "../decorators/IClassOf.js";
|
|
2
|
+
import DateTime from "../types/DateTime.js";
|
|
3
|
+
import type Workflow from "./Workflow.js";
|
|
4
|
+
import WorkflowStorage, { IWorkflowThrottleGroup } from "./WorkflowStorage.js";
|
|
5
|
+
export declare const runChildSymbol: unique symbol;
|
|
6
|
+
export interface IWorkflowResult<T> {
|
|
7
|
+
output: T;
|
|
8
|
+
state: "done" | "failed" | "queued";
|
|
9
|
+
error: string;
|
|
10
|
+
extra?: string;
|
|
11
|
+
updated?: DateTime;
|
|
12
|
+
queued?: DateTime;
|
|
13
|
+
}
|
|
14
|
+
export interface IWorkflowQueueParameter {
|
|
15
|
+
id?: string;
|
|
16
|
+
throwIfExists?: boolean;
|
|
17
|
+
eta?: DateTime;
|
|
18
|
+
parentID?: string;
|
|
19
|
+
taskGroup?: string;
|
|
20
|
+
throttle?: IWorkflowThrottleGroup;
|
|
21
|
+
}
|
|
22
|
+
export interface IWorkflowStartParams {
|
|
23
|
+
taskGroups?: string[];
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}
|
|
26
|
+
export default class WorkflowContext {
|
|
27
|
+
storage: WorkflowStorage;
|
|
28
|
+
private registry;
|
|
29
|
+
private stats;
|
|
30
|
+
constructor(storage: WorkflowStorage);
|
|
31
|
+
register(type: IClassOf<Workflow>): void;
|
|
32
|
+
start({ taskGroups, signal }?: IWorkflowStartParams): Promise<void>;
|
|
33
|
+
get<T = any>(c: IClassOf<Workflow<any, T>> | string, id?: string): Promise<IWorkflowResult<T>>;
|
|
34
|
+
queue<T>(type: IClassOf<Workflow<T>>, input: T, { id, throwIfExists, eta, parentID, taskGroup, throttle }?: IWorkflowQueueParameter): Promise<string>;
|
|
35
|
+
raiseEvent(id: string, { name, result, throwIfNotWaiting }: {
|
|
36
|
+
name: string;
|
|
37
|
+
result?: string;
|
|
38
|
+
throwIfNotWaiting?: boolean;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
log(...a: any[]): void;
|
|
41
|
+
getPendingCount({ taskGroup }?: {
|
|
42
|
+
taskGroup?: any;
|
|
43
|
+
}): Promise<number>;
|
|
44
|
+
processQueueOnce({ taskGroup, signal }?: {
|
|
45
|
+
taskGroup?: string;
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
}): Promise<number>;
|
|
48
|
+
runChild(w: Workflow, type: any, input: any, throttle?: IWorkflowThrottleGroup, taskGroup?: string): Promise<any>;
|
|
49
|
+
private startGroup;
|
|
50
|
+
private run;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=WorkflowContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowContext.d.ts","sourceRoot":"","sources":["../../src/workflows/WorkflowContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAQ1C,OAAO,eAAe,EAAE,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,eAAO,MAAM,cAAc,eAAqB,CAAC;AAuHjD,MAAM,WAAW,eAAe,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAA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CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,KAAA,EAAE,KAAK,KAAA,EAAE,QAAQ,CAAC,EAAE,sBAAsB,EAAE,SAAS,CAAC,EAAE,MAAM;YA6BhF,UAAU;YAkBV,GAAG;CAmFpB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import EntityContext from "../model/EntityContext.js";
|
|
2
|
+
import DateTime from "../types/DateTime.js";
|
|
3
|
+
export declare const loadedFromDb: unique symbol;
|
|
4
|
+
export declare class WorkflowItem {
|
|
5
|
+
id: string;
|
|
6
|
+
isWorkflow: boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
groupName: string;
|
|
9
|
+
input: string;
|
|
10
|
+
output: string;
|
|
11
|
+
eta: DateTime;
|
|
12
|
+
queued: DateTime;
|
|
13
|
+
updated: DateTime;
|
|
14
|
+
taskGroup: string;
|
|
15
|
+
throttleGroup: string;
|
|
16
|
+
priority: number;
|
|
17
|
+
lockedTTL: DateTime;
|
|
18
|
+
lockToken: string;
|
|
19
|
+
state: "queued" | "failed" | "done";
|
|
20
|
+
error: string;
|
|
21
|
+
extra: string;
|
|
22
|
+
parentID: string;
|
|
23
|
+
lastID: string;
|
|
24
|
+
parent: WorkflowItem;
|
|
25
|
+
children: WorkflowItem[];
|
|
26
|
+
}
|
|
27
|
+
export declare class WorkflowDbContext extends EntityContext {
|
|
28
|
+
workflows: import("../model/EntitySource.js").EntitySource<WorkflowItem>;
|
|
29
|
+
verifyFilters: boolean;
|
|
30
|
+
raiseEvents: boolean;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=WorkflowDbContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowDbContext.d.ts","sourceRoot":"","sources":["../../src/workflows/WorkflowDbContext.ts"],"names":[],"mappings":"AAKA,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAE5C,eAAO,MAAM,YAAY,eAAyB,CAAC;AAGnD,qBA6Ba,YAAY;IAGd,EAAE,EAAE,MAAM,CAAC;IAGX,UAAU,EAAE,OAAO,CAAC;IAGpB,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,EAAE,MAAM,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,MAAM,CAAC;IAGf,GAAG,EAAE,QAAQ,CAAC;IAGd,MAAM,EAAE,QAAQ,CAAC;IAGjB,OAAO,EAAE,QAAQ,CAAC;IAMlB,SAAS,EAAE,MAAM,CAAC;IAKlB,aAAa,EAAE,MAAM,CAAC;IAGtB,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,QAAQ,CAAC;IAGpB,SAAS,EAAE,MAAM,CAAC;IAGlB,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAGpC,KAAK,EAAE,MAAM,CAAC;IAGd,KAAK,EAAE,MAAM,CAAC;IAWd,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;IAEtB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC5B;AAED,qBACa,iBAAkB,SAAQ,aAAa;IAEzC,SAAS,gEAAqC;IAErD,aAAa,EAAE,OAAO,CAAS;IAE/B,WAAW,EAAE,OAAO,CAAS;CAEhC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IClassOf } from "../decorators/IClassOf.js";
|
|
2
|
+
import type Workflow from "./Workflow.js";
|
|
3
|
+
export interface IWorkflowSchema {
|
|
4
|
+
name: string;
|
|
5
|
+
type: IClassOf<Workflow>;
|
|
6
|
+
activities: string[];
|
|
7
|
+
uniqueActivities: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare const WorkflowRegistry: {
|
|
10
|
+
register(target: IClassOf<any>, key: any, unique?: boolean): IWorkflowSchema;
|
|
11
|
+
getByName(name: string): IWorkflowSchema;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=WorkflowRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowRegistry.d.ts","sourceRoot":"","sources":["../../src/workflows/WorkflowRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAKD,eAAO,MAAM,gBAAgB;qBACR,QAAQ,CAAC,GAAG,CAAC;oBAgBd,MAAM;CAGzB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BaseDriver } from "../drivers/base/BaseDriver.js";
|
|
2
|
+
import DateTime from "../types/DateTime.js";
|
|
3
|
+
import WorkflowClock from "./WorkflowClock.js";
|
|
4
|
+
import { loadedFromDb, WorkflowItem } from "./WorkflowDbContext.js";
|
|
5
|
+
import WorkflowTask from "./WorkflowTask.js";
|
|
6
|
+
export type IWorkflowThrottleGroup = {
|
|
7
|
+
group: string;
|
|
8
|
+
/**
|
|
9
|
+
* Throttling based on defer, the workflow will be scheduled in future
|
|
10
|
+
* only if current workflow in same throttle group is queued or running.
|
|
11
|
+
*/
|
|
12
|
+
deferSeconds?: number;
|
|
13
|
+
maxPerSecond?: never;
|
|
14
|
+
} | {
|
|
15
|
+
group: string;
|
|
16
|
+
deferSeconds?: never;
|
|
17
|
+
/**
|
|
18
|
+
* Throttled on based on maximum iterations per second.
|
|
19
|
+
*/
|
|
20
|
+
maxPerSecond?: number;
|
|
21
|
+
};
|
|
22
|
+
export default class WorkflowStorage {
|
|
23
|
+
private driver;
|
|
24
|
+
readonly clock: WorkflowClock;
|
|
25
|
+
constructor(driver: BaseDriver, clock: WorkflowClock);
|
|
26
|
+
getPendingWorkflowCount({ taskGroup }?: {
|
|
27
|
+
taskGroup?: any;
|
|
28
|
+
}): Promise<number>;
|
|
29
|
+
getLastEta(throttle: IWorkflowThrottleGroup): Promise<WorkflowItem>;
|
|
30
|
+
getNextEta(throttle: IWorkflowThrottleGroup): Promise<DateTime>;
|
|
31
|
+
getWorkflow(id: string): Promise<{
|
|
32
|
+
id: string;
|
|
33
|
+
parentID: string;
|
|
34
|
+
lockTTL: DateTime;
|
|
35
|
+
lockToken: string;
|
|
36
|
+
updated: DateTime;
|
|
37
|
+
eta: DateTime;
|
|
38
|
+
queued: DateTime;
|
|
39
|
+
state: "done" | "queued" | "failed";
|
|
40
|
+
output: string;
|
|
41
|
+
error: string;
|
|
42
|
+
lastID: string;
|
|
43
|
+
taskGroup: string;
|
|
44
|
+
extra: string;
|
|
45
|
+
[loadedFromDb]: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
getAny(id: string): Promise<{
|
|
48
|
+
id: string;
|
|
49
|
+
parentID: string;
|
|
50
|
+
lockTTL: DateTime;
|
|
51
|
+
lockToken: string;
|
|
52
|
+
updated: DateTime;
|
|
53
|
+
eta: DateTime;
|
|
54
|
+
queued: DateTime;
|
|
55
|
+
state: "done" | "queued" | "failed";
|
|
56
|
+
output: string;
|
|
57
|
+
error: string;
|
|
58
|
+
lastID: string;
|
|
59
|
+
[loadedFromDb]: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
extra(id: any, text?: any): Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Deletes given workflow and it's children
|
|
64
|
+
* @param id id to delete
|
|
65
|
+
* @returns true if all items are deleted
|
|
66
|
+
*/
|
|
67
|
+
delete(id: any): Promise<boolean>;
|
|
68
|
+
save(state: Partial<WorkflowItem>): Promise<void>;
|
|
69
|
+
dequeue(taskGroup: string, signal?: AbortSignal): Promise<WorkflowTask[]>;
|
|
70
|
+
seed(version?: any): Promise<void>;
|
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ajC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW;IAgF/C,IAAI,CAAC,OAAO,CAAC,KAAA;CAMtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type WorkflowDbContext, type WorkflowItem } from "./WorkflowDbContext.js";
|
|
2
|
+
export default class WorkflowTask implements Disposable {
|
|
3
|
+
readonly item: WorkflowItem;
|
|
4
|
+
readonly context: WorkflowDbContext;
|
|
5
|
+
timer: NodeJS.Timeout;
|
|
6
|
+
readonly signal: any;
|
|
7
|
+
private ac;
|
|
8
|
+
private timerKey;
|
|
9
|
+
constructor(item: WorkflowItem, context: WorkflowDbContext);
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
renewLock: () => void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=WorkflowTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowTask.d.ts","sourceRoot":"","sources":["../../src/workflows/WorkflowTask.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAIjG,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,UAAU;aAS/B,IAAI,EAAE,YAAY;aAClB,OAAO,EAAE,iBAAiB;IAR9C,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC;IAEtB,SAAgB,MAAM,MAAC;IACvB,OAAO,CAAC,EAAE,CAAkB;IAC5B,OAAO,CAAC,QAAQ,CAAC;gBAGG,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,iBAAiB;IAU9C,CAAC,MAAM,CAAC,OAAO,CAAC;IAUhB,SAAS,aAkBP;CACL"}
|
package/package.json
CHANGED