@lilaquadrat/interfaces 1.41.0 → 1.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/cjs/AccessRule.d.ts +5 -0
- package/lib/cjs/LimiterBreach.d.ts +15 -0
- package/lib/cjs/LimiterPluginOptions.d.ts +35 -0
- package/lib/cjs/LimiterTier.d.ts +10 -0
- package/lib/cjs/Storage.d.ts +2 -3
- package/lib/cjs/Structure.d.ts +8 -2
- package/lib/cjs/Upload.d.ts +8 -0
- package/lib/cjs/index.d.ts +4 -1
- package/lib/esm/AccessRule.d.ts +5 -0
- package/lib/esm/AccessRule.js +2 -0
- package/lib/esm/AccessRule.js.map +1 -0
- package/lib/esm/LimiterBreach.d.ts +15 -0
- package/lib/esm/LimiterBreach.js +2 -0
- package/lib/esm/LimiterBreach.js.map +1 -0
- package/lib/esm/LimiterPluginOptions.d.ts +35 -0
- package/lib/esm/LimiterPluginOptions.js +2 -0
- package/lib/esm/LimiterPluginOptions.js.map +1 -0
- package/lib/esm/LimiterTier.d.ts +10 -0
- package/lib/esm/LimiterTier.js +2 -0
- package/lib/esm/LimiterTier.js.map +1 -0
- package/lib/esm/Storage.d.ts +2 -3
- package/lib/esm/Structure.d.ts +8 -2
- package/lib/esm/Upload.d.ts +8 -0
- package/lib/esm/index.d.ts +4 -1
- package/package.json +1 -1
- package/src/AccessRule.ts +5 -0
- package/src/LimiterBreach.ts +15 -0
- package/src/LimiterPluginOptions.ts +37 -0
- package/src/LimiterTier.ts +10 -0
- package/src/Storage.ts +2 -3
- package/src/Structure.ts +10 -2
- package/src/Upload.ts +9 -1
- package/lib/cjs/Access.d.ts +0 -7
- package/lib/esm/Access.d.ts +0 -7
- package/lib/esm/Access.js +0 -2
- package/lib/esm/Access.js.map +0 -1
- package/src/Access.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.42.0](https://github.com/lilaquadrat/interfaces/compare/v1.41.0...v1.42.0) (2026-05-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **Limiter:** add LimiterTier, LimiterBreach and LimiterPluginOptions interfaces ([8dd392b](https://github.com/lilaquadrat/interfaces/commit/8dd392b10571d8d6c93c523dc3db7c961ddb5e6d))
|
|
11
|
+
* **Structure,Storage,Upload:** add file asset binding and member upload metadata ([485a044](https://github.com/lilaquadrat/interfaces/commit/485a044009f281696a6098493dc327cc3d490e23))
|
|
12
|
+
|
|
5
13
|
## [1.41.0](https://github.com/lilaquadrat/interfaces/compare/v1.40.2...v1.41.0) (2026-04-16)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returned by the rate limiter when a configured limit is exceeded. The
|
|
3
|
+
* caller is expected to respond 429 with the included Retry-After value
|
|
4
|
+
* (seconds until the offending window resets).
|
|
5
|
+
*/
|
|
6
|
+
export interface LimiterBreach {
|
|
7
|
+
/** Which bucket tripped first. */
|
|
8
|
+
interval: 'minute' | 'hour';
|
|
9
|
+
/** Configured limit for that interval. */
|
|
10
|
+
limit: number;
|
|
11
|
+
/** Observed count (post-increment) for that interval. */
|
|
12
|
+
count: number;
|
|
13
|
+
/** Seconds until the offending window resets. Suitable for Retry-After. */
|
|
14
|
+
retryAfter: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type LimiterTier } from './LimiterTier';
|
|
2
|
+
/**
|
|
3
|
+
* Per-prefix tier override. The longest matching `prefix` wins when several
|
|
4
|
+
* apply to the same request URL.
|
|
5
|
+
*/
|
|
6
|
+
export interface LimiterPrefixOverride {
|
|
7
|
+
prefix: string;
|
|
8
|
+
tier: LimiterTier;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Configuration accepted by the studio limiter Fastify plugin.
|
|
12
|
+
*
|
|
13
|
+
* Tiers are resolved from the request URL prefix:
|
|
14
|
+
* /public/... → tiers.public (IP-keyed)
|
|
15
|
+
* /members/... → tiers.members (user-keyed, IP fallback)
|
|
16
|
+
* everything → tiers.user (user-keyed, IP fallback)
|
|
17
|
+
*
|
|
18
|
+
* `namespace` is shared across APIs: same string = same counter pool.
|
|
19
|
+
*/
|
|
20
|
+
export interface LimiterPluginOptions {
|
|
21
|
+
/** Shared namespace across APIs. Same string = shared counters. */
|
|
22
|
+
namespace: string;
|
|
23
|
+
/** Tier per URL prefix family. */
|
|
24
|
+
tiers: {
|
|
25
|
+
public: LimiterTier;
|
|
26
|
+
members: LimiterTier;
|
|
27
|
+
user: LimiterTier;
|
|
28
|
+
};
|
|
29
|
+
/** Optional per-prefix overrides. Longest match wins. */
|
|
30
|
+
overrides?: LimiterPrefixOverride[];
|
|
31
|
+
/** Routes to skip entirely. Default: ['/health', '/']. */
|
|
32
|
+
ignoreRoutes?: string[];
|
|
33
|
+
/** Fail-open if Mongo errors. Default: true. */
|
|
34
|
+
skipOnError?: boolean;
|
|
35
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate-limit configuration for a single tier. Either or both fields may be
|
|
3
|
+
* set. A missing field means no limit at that interval.
|
|
4
|
+
*/
|
|
5
|
+
export interface LimiterTier {
|
|
6
|
+
/** Maximum requests allowed within a 60-second window. */
|
|
7
|
+
minute?: number;
|
|
8
|
+
/** Maximum requests allowed within a 60-minute window. */
|
|
9
|
+
hour?: number;
|
|
10
|
+
}
|
package/lib/cjs/Storage.d.ts
CHANGED
package/lib/cjs/Structure.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export interface Structure {
|
|
|
10
10
|
/**
|
|
11
11
|
* Type of the structure
|
|
12
12
|
*/
|
|
13
|
-
type: 'string' | 'text' | 'number' | 'select' | 'boolean';
|
|
13
|
+
type: 'string' | 'text' | 'number' | 'select' | 'boolean' | 'file';
|
|
14
14
|
model: 'listsParticipants' | 'customers';
|
|
15
15
|
/**
|
|
16
|
-
* Maximum value for number
|
|
16
|
+
* Maximum value for number, maximum length for text, or maximum number of files for file type
|
|
17
17
|
*/
|
|
18
18
|
max?: number;
|
|
19
19
|
/**
|
|
@@ -34,5 +34,11 @@ export interface Structure {
|
|
|
34
34
|
*/
|
|
35
35
|
company: string;
|
|
36
36
|
project: string;
|
|
37
|
+
/**
|
|
38
|
+
* file upload specifics
|
|
39
|
+
*/
|
|
40
|
+
maxFileSize?: number;
|
|
41
|
+
allowedMimeTypes?: string[];
|
|
37
42
|
description?: string;
|
|
43
|
+
assetId?: string;
|
|
38
44
|
}
|
package/lib/cjs/Upload.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface Upload {
|
|
|
10
10
|
list?: ObjectIdString | ObjectId;
|
|
11
11
|
user?: string;
|
|
12
12
|
app: string;
|
|
13
|
+
assetId?: string;
|
|
13
14
|
mimetype: string;
|
|
14
15
|
size?: number;
|
|
15
16
|
chunks: number;
|
|
@@ -25,5 +26,12 @@ export interface Upload {
|
|
|
25
26
|
*/
|
|
26
27
|
thumbnails?: boolean;
|
|
27
28
|
overwrite?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* when a member uploads a file it needs to be bound to a content id and a specific module
|
|
31
|
+
* to limit the access to upload files
|
|
32
|
+
*/
|
|
33
|
+
contentId?: string;
|
|
34
|
+
moduleUuid?: string;
|
|
35
|
+
structureInternalId?: ObjectId;
|
|
28
36
|
};
|
|
29
37
|
}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './AccessRule';
|
|
2
2
|
export * from './Accordion';
|
|
3
3
|
export * from './AccordtionElement';
|
|
4
4
|
export * from './Action';
|
|
@@ -118,6 +118,9 @@ export * from './InvoiceReferences';
|
|
|
118
118
|
export * from './InvoiceTaxBreakdown';
|
|
119
119
|
export * from './InvoiceTotals';
|
|
120
120
|
export * from './InvoiceWithXml';
|
|
121
|
+
export * from './LimiterBreach';
|
|
122
|
+
export * from './LimiterPluginOptions';
|
|
123
|
+
export * from './LimiterTier';
|
|
121
124
|
export * from './Link';
|
|
122
125
|
export * from './LinkGroupElement';
|
|
123
126
|
export * from './List';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessRule.js","sourceRoot":"","sources":["../../src/AccessRule.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returned by the rate limiter when a configured limit is exceeded. The
|
|
3
|
+
* caller is expected to respond 429 with the included Retry-After value
|
|
4
|
+
* (seconds until the offending window resets).
|
|
5
|
+
*/
|
|
6
|
+
export interface LimiterBreach {
|
|
7
|
+
/** Which bucket tripped first. */
|
|
8
|
+
interval: 'minute' | 'hour';
|
|
9
|
+
/** Configured limit for that interval. */
|
|
10
|
+
limit: number;
|
|
11
|
+
/** Observed count (post-increment) for that interval. */
|
|
12
|
+
count: number;
|
|
13
|
+
/** Seconds until the offending window resets. Suitable for Retry-After. */
|
|
14
|
+
retryAfter: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimiterBreach.js","sourceRoot":"","sources":["../../src/LimiterBreach.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type LimiterTier } from './LimiterTier';
|
|
2
|
+
/**
|
|
3
|
+
* Per-prefix tier override. The longest matching `prefix` wins when several
|
|
4
|
+
* apply to the same request URL.
|
|
5
|
+
*/
|
|
6
|
+
export interface LimiterPrefixOverride {
|
|
7
|
+
prefix: string;
|
|
8
|
+
tier: LimiterTier;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Configuration accepted by the studio limiter Fastify plugin.
|
|
12
|
+
*
|
|
13
|
+
* Tiers are resolved from the request URL prefix:
|
|
14
|
+
* /public/... → tiers.public (IP-keyed)
|
|
15
|
+
* /members/... → tiers.members (user-keyed, IP fallback)
|
|
16
|
+
* everything → tiers.user (user-keyed, IP fallback)
|
|
17
|
+
*
|
|
18
|
+
* `namespace` is shared across APIs: same string = same counter pool.
|
|
19
|
+
*/
|
|
20
|
+
export interface LimiterPluginOptions {
|
|
21
|
+
/** Shared namespace across APIs. Same string = shared counters. */
|
|
22
|
+
namespace: string;
|
|
23
|
+
/** Tier per URL prefix family. */
|
|
24
|
+
tiers: {
|
|
25
|
+
public: LimiterTier;
|
|
26
|
+
members: LimiterTier;
|
|
27
|
+
user: LimiterTier;
|
|
28
|
+
};
|
|
29
|
+
/** Optional per-prefix overrides. Longest match wins. */
|
|
30
|
+
overrides?: LimiterPrefixOverride[];
|
|
31
|
+
/** Routes to skip entirely. Default: ['/health', '/']. */
|
|
32
|
+
ignoreRoutes?: string[];
|
|
33
|
+
/** Fail-open if Mongo errors. Default: true. */
|
|
34
|
+
skipOnError?: boolean;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimiterPluginOptions.js","sourceRoot":"","sources":["../../src/LimiterPluginOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate-limit configuration for a single tier. Either or both fields may be
|
|
3
|
+
* set. A missing field means no limit at that interval.
|
|
4
|
+
*/
|
|
5
|
+
export interface LimiterTier {
|
|
6
|
+
/** Maximum requests allowed within a 60-second window. */
|
|
7
|
+
minute?: number;
|
|
8
|
+
/** Maximum requests allowed within a 60-minute window. */
|
|
9
|
+
hour?: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimiterTier.js","sourceRoot":"","sources":["../../src/LimiterTier.ts"],"names":[],"mappings":""}
|
package/lib/esm/Storage.d.ts
CHANGED
package/lib/esm/Structure.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export interface Structure {
|
|
|
10
10
|
/**
|
|
11
11
|
* Type of the structure
|
|
12
12
|
*/
|
|
13
|
-
type: 'string' | 'text' | 'number' | 'select' | 'boolean';
|
|
13
|
+
type: 'string' | 'text' | 'number' | 'select' | 'boolean' | 'file';
|
|
14
14
|
model: 'listsParticipants' | 'customers';
|
|
15
15
|
/**
|
|
16
|
-
* Maximum value for number
|
|
16
|
+
* Maximum value for number, maximum length for text, or maximum number of files for file type
|
|
17
17
|
*/
|
|
18
18
|
max?: number;
|
|
19
19
|
/**
|
|
@@ -34,5 +34,11 @@ export interface Structure {
|
|
|
34
34
|
*/
|
|
35
35
|
company: string;
|
|
36
36
|
project: string;
|
|
37
|
+
/**
|
|
38
|
+
* file upload specifics
|
|
39
|
+
*/
|
|
40
|
+
maxFileSize?: number;
|
|
41
|
+
allowedMimeTypes?: string[];
|
|
37
42
|
description?: string;
|
|
43
|
+
assetId?: string;
|
|
38
44
|
}
|
package/lib/esm/Upload.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface Upload {
|
|
|
10
10
|
list?: ObjectIdString | ObjectId;
|
|
11
11
|
user?: string;
|
|
12
12
|
app: string;
|
|
13
|
+
assetId?: string;
|
|
13
14
|
mimetype: string;
|
|
14
15
|
size?: number;
|
|
15
16
|
chunks: number;
|
|
@@ -25,5 +26,12 @@ export interface Upload {
|
|
|
25
26
|
*/
|
|
26
27
|
thumbnails?: boolean;
|
|
27
28
|
overwrite?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* when a member uploads a file it needs to be bound to a content id and a specific module
|
|
31
|
+
* to limit the access to upload files
|
|
32
|
+
*/
|
|
33
|
+
contentId?: string;
|
|
34
|
+
moduleUuid?: string;
|
|
35
|
+
structureInternalId?: ObjectId;
|
|
28
36
|
};
|
|
29
37
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './AccessRule';
|
|
2
2
|
export * from './Accordion';
|
|
3
3
|
export * from './AccordtionElement';
|
|
4
4
|
export * from './Action';
|
|
@@ -118,6 +118,9 @@ export * from './InvoiceReferences';
|
|
|
118
118
|
export * from './InvoiceTaxBreakdown';
|
|
119
119
|
export * from './InvoiceTotals';
|
|
120
120
|
export * from './InvoiceWithXml';
|
|
121
|
+
export * from './LimiterBreach';
|
|
122
|
+
export * from './LimiterPluginOptions';
|
|
123
|
+
export * from './LimiterTier';
|
|
121
124
|
export * from './Link';
|
|
122
125
|
export * from './LinkGroupElement';
|
|
123
126
|
export * from './List';
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returned by the rate limiter when a configured limit is exceeded. The
|
|
3
|
+
* caller is expected to respond 429 with the included Retry-After value
|
|
4
|
+
* (seconds until the offending window resets).
|
|
5
|
+
*/
|
|
6
|
+
export interface LimiterBreach {
|
|
7
|
+
/** Which bucket tripped first. */
|
|
8
|
+
interval: 'minute' | 'hour';
|
|
9
|
+
/** Configured limit for that interval. */
|
|
10
|
+
limit: number;
|
|
11
|
+
/** Observed count (post-increment) for that interval. */
|
|
12
|
+
count: number;
|
|
13
|
+
/** Seconds until the offending window resets. Suitable for Retry-After. */
|
|
14
|
+
retryAfter: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type LimiterTier } from './LimiterTier';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Per-prefix tier override. The longest matching `prefix` wins when several
|
|
5
|
+
* apply to the same request URL.
|
|
6
|
+
*/
|
|
7
|
+
export interface LimiterPrefixOverride {
|
|
8
|
+
prefix: string;
|
|
9
|
+
tier: LimiterTier;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Configuration accepted by the studio limiter Fastify plugin.
|
|
14
|
+
*
|
|
15
|
+
* Tiers are resolved from the request URL prefix:
|
|
16
|
+
* /public/... → tiers.public (IP-keyed)
|
|
17
|
+
* /members/... → tiers.members (user-keyed, IP fallback)
|
|
18
|
+
* everything → tiers.user (user-keyed, IP fallback)
|
|
19
|
+
*
|
|
20
|
+
* `namespace` is shared across APIs: same string = same counter pool.
|
|
21
|
+
*/
|
|
22
|
+
export interface LimiterPluginOptions {
|
|
23
|
+
/** Shared namespace across APIs. Same string = shared counters. */
|
|
24
|
+
namespace: string;
|
|
25
|
+
/** Tier per URL prefix family. */
|
|
26
|
+
tiers: {
|
|
27
|
+
public: LimiterTier;
|
|
28
|
+
members: LimiterTier;
|
|
29
|
+
user: LimiterTier;
|
|
30
|
+
};
|
|
31
|
+
/** Optional per-prefix overrides. Longest match wins. */
|
|
32
|
+
overrides?: LimiterPrefixOverride[];
|
|
33
|
+
/** Routes to skip entirely. Default: ['/health', '/']. */
|
|
34
|
+
ignoreRoutes?: string[];
|
|
35
|
+
/** Fail-open if Mongo errors. Default: true. */
|
|
36
|
+
skipOnError?: boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate-limit configuration for a single tier. Either or both fields may be
|
|
3
|
+
* set. A missing field means no limit at that interval.
|
|
4
|
+
*/
|
|
5
|
+
export interface LimiterTier {
|
|
6
|
+
/** Maximum requests allowed within a 60-second window. */
|
|
7
|
+
minute?: number;
|
|
8
|
+
/** Maximum requests allowed within a 60-minute window. */
|
|
9
|
+
hour?: number;
|
|
10
|
+
}
|
package/src/Storage.ts
CHANGED
package/src/Structure.ts
CHANGED
|
@@ -12,11 +12,11 @@ export interface Structure {
|
|
|
12
12
|
/**
|
|
13
13
|
* Type of the structure
|
|
14
14
|
*/
|
|
15
|
-
type: 'string' | 'text' | 'number' | 'select' | 'boolean'
|
|
15
|
+
type: 'string' | 'text' | 'number' | 'select' | 'boolean' | 'file'
|
|
16
16
|
model: 'listsParticipants' | 'customers'
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Maximum value for number
|
|
19
|
+
* Maximum value for number, maximum length for text, or maximum number of files for file type
|
|
20
20
|
*/
|
|
21
21
|
max?: number
|
|
22
22
|
|
|
@@ -40,5 +40,13 @@ export interface Structure {
|
|
|
40
40
|
company: string
|
|
41
41
|
project: string
|
|
42
42
|
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* file upload specifics
|
|
46
|
+
*/
|
|
47
|
+
maxFileSize?: number
|
|
48
|
+
allowedMimeTypes?: string[]
|
|
49
|
+
|
|
43
50
|
description?: string
|
|
51
|
+
assetId?: string
|
|
44
52
|
}
|
package/src/Upload.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface Upload {
|
|
|
11
11
|
list?: ObjectIdString | ObjectId;
|
|
12
12
|
user?: string;
|
|
13
13
|
app: string;
|
|
14
|
+
assetId?: string;
|
|
14
15
|
mimetype: string;
|
|
15
16
|
size?: number;
|
|
16
17
|
chunks: number;
|
|
@@ -21,7 +22,14 @@ export interface Upload {
|
|
|
21
22
|
/**
|
|
22
23
|
* create thumbnails for images
|
|
23
24
|
*/
|
|
24
|
-
thumbnails?: boolean
|
|
25
|
+
thumbnails?: boolean
|
|
25
26
|
overwrite?: boolean
|
|
27
|
+
/**
|
|
28
|
+
* when a member uploads a file it needs to be bound to a content id and a specific module
|
|
29
|
+
* to limit the access to upload files
|
|
30
|
+
*/
|
|
31
|
+
contentId?: string
|
|
32
|
+
moduleUuid?: string
|
|
33
|
+
structureInternalId?: ObjectId
|
|
26
34
|
}
|
|
27
35
|
}
|
package/lib/cjs/Access.d.ts
DELETED
package/lib/esm/Access.d.ts
DELETED
package/lib/esm/Access.js
DELETED
package/lib/esm/Access.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Access.js","sourceRoot":"","sources":["../../src/Access.ts"],"names":[],"mappings":""}
|