@junobuild/config 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -30
- package/dist/types/dev/juno.dev.config.d.ts +55 -0
- package/dist/types/mainnet/authentication.config.d.ts +6 -0
- package/dist/types/mainnet/juno.config.d.ts +20 -0
- package/dist/types/mainnet/juno.env.d.ts +12 -0
- package/dist/types/mainnet/satellite.config.d.ts +38 -4
- package/dist/types/mainnet/storage.config.d.ts +29 -5
- package/dist/types/types/encoding.d.ts +4 -0
- package/dist/types/types/rules.d.ts +62 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,50 +63,64 @@ Configuration options for [Juno] CLI.
|
|
|
63
63
|
|
|
64
64
|
#### :gear: JunoConfigEnv
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
|
66
|
+
Represents the environment configuration for Juno.
|
|
67
|
+
|
|
68
|
+
| Property | Type | Description |
|
|
69
|
+
| -------- | -------- | ---------------------------------------------------------- |
|
|
70
|
+
| `mode` | `string` | The mode of the Juno configuration. type: {JunoConfigMode} |
|
|
69
71
|
|
|
70
72
|
#### :gear: OrbiterConfig
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
|
75
|
-
|
|
|
74
|
+
Represents the configuration for an orbiter.
|
|
75
|
+
|
|
76
|
+
| Property | Type | Description |
|
|
77
|
+
| ----------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
78
|
+
| `id` | `string` | The identifier of the orbiter used in the dApp. type: {string} |
|
|
79
|
+
| `orbiterId` | `string or undefined` | The deprecated identifier of the orbiter. deprecated: `orbiterId` will be removed in the future. Use `id` instead.type: {string} |
|
|
76
80
|
|
|
77
81
|
#### :gear: JunoConfig
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
+
Represents the overall configuration for Juno.
|
|
84
|
+
|
|
85
|
+
| Property | Type | Description |
|
|
86
|
+
| ----------- | ---------------------------- | ------------------------------------------------------------------------- |
|
|
87
|
+
| `satellite` | `SatelliteConfig` | The configuration for the satellite. type: {SatelliteConfig} |
|
|
88
|
+
| `orbiter` | `OrbiterConfig or undefined` | The optional configuration for the orbiter. type: {OrbiterConfig}optional |
|
|
83
89
|
|
|
84
90
|
#### :gear: SatelliteDevCollections
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
92
|
+
Represents the collections configuration for a satellite in a development environment.
|
|
93
|
+
|
|
94
|
+
| Property | Type | Description |
|
|
95
|
+
| --------- | ---------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
96
|
+
| `db` | `SatelliteDevDbCollection[] or undefined` | The database collections configuration. type: {SatelliteDevDbCollection[]}optional |
|
|
97
|
+
| `storage` | `SatelliteDevStorageCollection[] or undefined` | The storage collections configuration. type: {SatelliteDevStorageCollection[]}optional |
|
|
90
98
|
|
|
91
99
|
#### :gear: SatelliteDevController
|
|
92
100
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
|
96
|
-
|
|
|
101
|
+
Represents a controller configuration for a satellite in a development environment.
|
|
102
|
+
|
|
103
|
+
| Property | Type | Description |
|
|
104
|
+
| -------- | -------------------- | --------------------------------------------------------- | -------- |
|
|
105
|
+
| `id` | `string` | The unique identifier of the controller. type: {string} |
|
|
106
|
+
| `scope` | `"write" or "admin"` | The scope of the controller's permissions. type: {'write' | 'admin'} |
|
|
97
107
|
|
|
98
108
|
#### :gear: SatelliteDevConfig
|
|
99
109
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
|
103
|
-
|
|
|
110
|
+
Represents the development configuration for a satellite.
|
|
111
|
+
|
|
112
|
+
| Property | Type | Description |
|
|
113
|
+
| ------------- | --------------------------------------- | -------------------------------------------------------------------------------- |
|
|
114
|
+
| `collections` | `SatelliteDevCollections` | The collections configuration. type: {SatelliteDevCollections} |
|
|
115
|
+
| `controllers` | `SatelliteDevController[] or undefined` | The optional controllers configuration. type: {SatelliteDevController[]}optional |
|
|
104
116
|
|
|
105
117
|
#### :gear: JunoDevConfig
|
|
106
118
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
|
119
|
+
Represents the development configuration for Juno.
|
|
120
|
+
|
|
121
|
+
| Property | Type | Description |
|
|
122
|
+
| ----------- | -------------------- | --------------------------------------------------------------------------- |
|
|
123
|
+
| `satellite` | `SatelliteDevConfig` | The development configuration for the satellite. type: {SatelliteDevConfig} |
|
|
110
124
|
|
|
111
125
|
### :cocktail: Types
|
|
112
126
|
|
|
@@ -123,7 +137,7 @@ Configuration options for [Juno] CLI.
|
|
|
123
137
|
| --------------- | --------------------------------------------------------- |
|
|
124
138
|
| `ENCODING_TYPE` | `'identity' or 'gzip' or 'compress' or 'deflate' or 'br'` |
|
|
125
139
|
|
|
126
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/types/encoding.ts#
|
|
140
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/types/encoding.ts#L5)
|
|
127
141
|
|
|
128
142
|
#### :gear: JunoConfigMode
|
|
129
143
|
|
|
@@ -131,7 +145,7 @@ Configuration options for [Juno] CLI.
|
|
|
131
145
|
| ---------------- | ------------------------ |
|
|
132
146
|
| `JunoConfigMode` | `'production' or string` |
|
|
133
147
|
|
|
134
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/mainnet/juno.env.ts#
|
|
148
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/mainnet/juno.env.ts#L5)
|
|
135
149
|
|
|
136
150
|
#### :gear: SatelliteDevDbCollection
|
|
137
151
|
|
|
@@ -139,7 +153,7 @@ Configuration options for [Juno] CLI.
|
|
|
139
153
|
| -------------------------- | ----------------------------------------------------- |
|
|
140
154
|
| `SatelliteDevDbCollection` | `Omit<Rule, 'createdAt' or 'updatedAt' or 'maxSize'>` |
|
|
141
155
|
|
|
142
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/dev/juno.dev.config.ts#
|
|
156
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/dev/juno.dev.config.ts#L7)
|
|
143
157
|
|
|
144
158
|
#### :gear: SatelliteDevStorageCollection
|
|
145
159
|
|
|
@@ -147,7 +161,7 @@ Configuration options for [Juno] CLI.
|
|
|
147
161
|
| ------------------------------- | --------------------------------------------------------- |
|
|
148
162
|
| `SatelliteDevStorageCollection` | `Omit<Rule, 'createdAt' or 'updatedAt' or 'maxCapacity'>` |
|
|
149
163
|
|
|
150
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/dev/juno.dev.config.ts#
|
|
164
|
+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/dev/juno.dev.config.ts#L13)
|
|
151
165
|
|
|
152
166
|
#### :gear: JunoDevConfigFn
|
|
153
167
|
|
|
@@ -1,18 +1,73 @@
|
|
|
1
1
|
import type { Rule } from '../types/rules';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a database collection configuration for a satellite in a development environment.
|
|
4
|
+
* @typedef {Omit<Rule, 'createdAt' | 'updatedAt' | 'maxSize'>} SatelliteDevDbCollection
|
|
5
|
+
*/
|
|
2
6
|
export type SatelliteDevDbCollection = Omit<Rule, 'createdAt' | 'updatedAt' | 'maxSize'>;
|
|
7
|
+
/**
|
|
8
|
+
* Represents a storage collection configuration for a satellite in a development environment.
|
|
9
|
+
* @typedef {Omit<Rule, 'createdAt' | 'updatedAt' | 'maxCapacity'>} SatelliteDevStorageCollection
|
|
10
|
+
*/
|
|
3
11
|
export type SatelliteDevStorageCollection = Omit<Rule, 'createdAt' | 'updatedAt' | 'maxCapacity'>;
|
|
12
|
+
/**
|
|
13
|
+
* Represents the collections configuration for a satellite in a development environment.
|
|
14
|
+
* @interface SatelliteDevCollections
|
|
15
|
+
*/
|
|
4
16
|
export interface SatelliteDevCollections {
|
|
17
|
+
/**
|
|
18
|
+
* The database collections configuration.
|
|
19
|
+
* @type {SatelliteDevDbCollection[]}
|
|
20
|
+
* @optional
|
|
21
|
+
*/
|
|
5
22
|
db?: SatelliteDevDbCollection[];
|
|
23
|
+
/**
|
|
24
|
+
* The storage collections configuration.
|
|
25
|
+
* @type {SatelliteDevStorageCollection[]}
|
|
26
|
+
* @optional
|
|
27
|
+
*/
|
|
6
28
|
storage?: SatelliteDevStorageCollection[];
|
|
7
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a controller configuration for a satellite in a development environment.
|
|
32
|
+
* @interface SatelliteDevController
|
|
33
|
+
*/
|
|
8
34
|
export interface SatelliteDevController {
|
|
35
|
+
/**
|
|
36
|
+
* The unique identifier of the controller.
|
|
37
|
+
* @type {string}
|
|
38
|
+
*/
|
|
9
39
|
id: string;
|
|
40
|
+
/**
|
|
41
|
+
* The scope of the controller's permissions.
|
|
42
|
+
* @type {'write' | 'admin'}
|
|
43
|
+
*/
|
|
10
44
|
scope: 'write' | 'admin';
|
|
11
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Represents the development configuration for a satellite.
|
|
48
|
+
* @interface SatelliteDevConfig
|
|
49
|
+
*/
|
|
12
50
|
export interface SatelliteDevConfig {
|
|
51
|
+
/**
|
|
52
|
+
* The collections configuration.
|
|
53
|
+
* @type {SatelliteDevCollections}
|
|
54
|
+
*/
|
|
13
55
|
collections: SatelliteDevCollections;
|
|
56
|
+
/**
|
|
57
|
+
* The optional controllers configuration.
|
|
58
|
+
* @type {SatelliteDevController[]}
|
|
59
|
+
* @optional
|
|
60
|
+
*/
|
|
14
61
|
controllers?: SatelliteDevController[];
|
|
15
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Represents the development configuration for Juno.
|
|
65
|
+
* @interface JunoDevConfig
|
|
66
|
+
*/
|
|
16
67
|
export interface JunoDevConfig {
|
|
68
|
+
/**
|
|
69
|
+
* The development configuration for the satellite.
|
|
70
|
+
* @type {SatelliteDevConfig}
|
|
71
|
+
*/
|
|
17
72
|
satellite: SatelliteDevConfig;
|
|
18
73
|
}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configure the behavior of Internet Identity.
|
|
3
|
+
* @interface AuthenticationConfigInternetIdentity
|
|
3
4
|
*/
|
|
4
5
|
export interface AuthenticationConfigInternetIdentity {
|
|
5
6
|
/**
|
|
6
7
|
* This setting ensures that users are recognized on your app, regardless of whether they use the default URL or any other custom domain.
|
|
7
8
|
* For example, if set to hello.com, a user signing on at https://hello.com will receive the same identifier (principal) as when signing on at https://www.hello.com.
|
|
9
|
+
* @type {string}
|
|
10
|
+
* @optional
|
|
8
11
|
*/
|
|
9
12
|
derivationOrigin?: string;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* Configures the Authentication options of a Satellite.
|
|
16
|
+
* @interface AuthenticationConfig
|
|
13
17
|
*/
|
|
14
18
|
export interface AuthenticationConfig {
|
|
15
19
|
/**
|
|
16
20
|
* Optional configuration of Internet Identity authentication method.
|
|
21
|
+
* @type {AuthenticationConfigInternetIdentity}
|
|
22
|
+
* @optional
|
|
17
23
|
*/
|
|
18
24
|
internetIdentity?: AuthenticationConfigInternetIdentity;
|
|
19
25
|
}
|
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
import type { SatelliteConfig } from './satellite.config';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the configuration for an orbiter.
|
|
4
|
+
* @interface OrbiterConfig
|
|
5
|
+
*/
|
|
2
6
|
export interface OrbiterConfig {
|
|
3
7
|
/**
|
|
4
8
|
* The identifier of the orbiter used in the dApp.
|
|
9
|
+
* @type {string}
|
|
5
10
|
*/
|
|
6
11
|
id: string;
|
|
7
12
|
/**
|
|
13
|
+
* The deprecated identifier of the orbiter.
|
|
8
14
|
* @deprecated `orbiterId` will be removed in the future. Use `id` instead.
|
|
15
|
+
* @type {string}
|
|
9
16
|
*/
|
|
10
17
|
orbiterId?: string;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents the overall configuration for Juno.
|
|
21
|
+
* @interface JunoConfig
|
|
22
|
+
*/
|
|
12
23
|
export interface JunoConfig {
|
|
24
|
+
/**
|
|
25
|
+
* The configuration for the satellite.
|
|
26
|
+
* @type {SatelliteConfig}
|
|
27
|
+
*/
|
|
13
28
|
satellite: SatelliteConfig;
|
|
29
|
+
/**
|
|
30
|
+
* The optional configuration for the orbiter.
|
|
31
|
+
* @type {OrbiterConfig}
|
|
32
|
+
* @optional
|
|
33
|
+
*/
|
|
14
34
|
orbiter?: OrbiterConfig;
|
|
15
35
|
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the mode of the Juno configuration.
|
|
3
|
+
* @typedef {'production' | string} JunoConfigMode
|
|
4
|
+
*/
|
|
1
5
|
export type JunoConfigMode = 'production' | string;
|
|
6
|
+
/**
|
|
7
|
+
* Represents the environment configuration for Juno.
|
|
8
|
+
* @interface JunoConfigEnv
|
|
9
|
+
*/
|
|
2
10
|
export interface JunoConfigEnv {
|
|
11
|
+
/**
|
|
12
|
+
* The mode of the Juno configuration.
|
|
13
|
+
* @type {JunoConfigMode}
|
|
14
|
+
*/
|
|
3
15
|
mode: JunoConfigMode;
|
|
4
16
|
}
|
|
@@ -3,6 +3,10 @@ import type { Either } from '../utils/ts.utils';
|
|
|
3
3
|
import type { AuthenticationConfig } from './authentication.config';
|
|
4
4
|
import type { JunoConfigMode } from './juno.env';
|
|
5
5
|
import type { StorageConfig } from './storage.config';
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for satellite assertions.
|
|
8
|
+
* @interface SatelliteAssertions
|
|
9
|
+
*/
|
|
6
10
|
export interface SatelliteAssertions {
|
|
7
11
|
/**
|
|
8
12
|
* Configuration for the heap memory size check, which can be:
|
|
@@ -10,20 +14,32 @@ export interface SatelliteAssertions {
|
|
|
10
14
|
* - `false` to disable the heap memory size check,
|
|
11
15
|
* - A `number` to specify a custom threshold in MB (megabytes) for the heap memory size check.
|
|
12
16
|
*
|
|
13
|
-
* If not specified, then `true` is used as default value.
|
|
17
|
+
* If not specified, then `true` is used as the default value.
|
|
18
|
+
* @type {number | boolean}
|
|
14
19
|
*/
|
|
15
20
|
heapMemory?: number | boolean;
|
|
16
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Represents the unique identifier for a satellite.
|
|
24
|
+
* @interface SatelliteId
|
|
25
|
+
*/
|
|
17
26
|
export interface SatelliteId {
|
|
18
27
|
/**
|
|
19
28
|
* The unique identifier (ID) of the satellite for this application.
|
|
29
|
+
* @type {string}
|
|
20
30
|
*/
|
|
21
31
|
id: string;
|
|
22
32
|
/**
|
|
33
|
+
* The deprecated unique identifier (ID) of the satellite.
|
|
23
34
|
* @deprecated `satelliteId` will be removed in the future. Use `id` instead.
|
|
35
|
+
* @type {string}
|
|
24
36
|
*/
|
|
25
37
|
satelliteId?: string;
|
|
26
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Represents a mapping of satellite identifiers to different configurations based on the mode of the application.
|
|
41
|
+
* @interface SatelliteIds
|
|
42
|
+
*/
|
|
27
43
|
export interface SatelliteIds {
|
|
28
44
|
/**
|
|
29
45
|
* A mapping of satellite identifiers (IDs) to different configurations based on the mode of the application.
|
|
@@ -35,34 +51,48 @@ export interface SatelliteIds {
|
|
|
35
51
|
* "production": "xo2hm-lqaaa-aaaal-ab3oa-cai",
|
|
36
52
|
* "staging": "gl6nx-5maaa-aaaaa-qaaqq-cai"
|
|
37
53
|
* }
|
|
54
|
+
* @type {Record<JunoConfigMode, string>}
|
|
38
55
|
*/
|
|
39
56
|
ids: Record<JunoConfigMode, string>;
|
|
40
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Represents the configuration for a satellite.
|
|
60
|
+
* @typedef {Either<SatelliteId, SatelliteIds>} SatelliteConfig
|
|
61
|
+
*/
|
|
41
62
|
export type SatelliteConfig = Either<SatelliteId, SatelliteIds> & {
|
|
42
63
|
/**
|
|
43
64
|
* Specifies the directory from which to deploy to storage.
|
|
44
65
|
* For instance, if `npm run build` outputs files to a `dist` folder, use `source: 'dist'`.
|
|
45
66
|
*
|
|
46
|
-
* @default
|
|
67
|
+
* @default 'build'
|
|
68
|
+
* @type {string}
|
|
47
69
|
*/
|
|
48
70
|
source?: string;
|
|
49
71
|
/**
|
|
50
72
|
* Optional configuration parameters for the satellite, affecting the operational behavior of its Storage.
|
|
51
|
-
* Changes to these parameters must be applied manually afterwards for example with the CLI using `juno config` commands.
|
|
73
|
+
* Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.
|
|
74
|
+
* @type {StorageConfig}
|
|
75
|
+
* @optional
|
|
52
76
|
*/
|
|
53
77
|
storage?: StorageConfig;
|
|
54
78
|
/**
|
|
55
79
|
* Optional configuration parameters for the satellite, affecting the operational behavior of its Authentication.
|
|
56
|
-
* Changes to these parameters must be applied manually afterwards for example with the CLI using `juno config` commands.
|
|
80
|
+
* Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.
|
|
81
|
+
* @type {AuthenticationConfig}
|
|
82
|
+
* @optional
|
|
57
83
|
*/
|
|
58
84
|
authentication?: AuthenticationConfig;
|
|
59
85
|
/**
|
|
60
86
|
* Specifies files or patterns to ignore during deployment, using glob patterns similar to those in .gitignore.
|
|
87
|
+
* @type {string[]}
|
|
88
|
+
* @optional
|
|
61
89
|
*/
|
|
62
90
|
ignore?: string[];
|
|
63
91
|
/**
|
|
64
92
|
* Controls the Gzip compression optimization for files in the source folder. By default, it targets JavaScript (js), ES Module (mjs), and CSS (css) files.
|
|
65
93
|
* You can disable this by setting it to `false` or customize it with a different file matching pattern using glob syntax.
|
|
94
|
+
* @type {string | false}
|
|
95
|
+
* @optional
|
|
66
96
|
*/
|
|
67
97
|
gzip?: string | false;
|
|
68
98
|
/**
|
|
@@ -73,10 +103,14 @@ export type SatelliteConfig = Either<SatelliteId, SatelliteIds> & {
|
|
|
73
103
|
* - `.zlib` for deflate,
|
|
74
104
|
* - anything else defaults to `identity`.
|
|
75
105
|
* The "encoding" attribute allows overriding default mappings with an array of glob patterns and encoding types.
|
|
106
|
+
* @type {Array<[string, ENCODING_TYPE]>}
|
|
107
|
+
* @optional
|
|
76
108
|
*/
|
|
77
109
|
encoding?: Array<[string, ENCODING_TYPE]>;
|
|
78
110
|
/**
|
|
79
111
|
* Optional configurations to override default assertions made by the CLI regarding satellite deployment conditions.
|
|
112
|
+
* @type {SatelliteAssertions}
|
|
113
|
+
* @optional
|
|
80
114
|
*/
|
|
81
115
|
assertions?: SatelliteAssertions;
|
|
82
116
|
};
|
|
@@ -1,65 +1,87 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a glob pattern for matching files in the storage configuration.
|
|
3
|
+
* @typedef {string} StorageConfigSourceGlob
|
|
3
4
|
*/
|
|
4
5
|
export type StorageConfigSourceGlob = string;
|
|
5
6
|
/**
|
|
6
|
-
* Headers allow the client and the satellite to pass additional information along with a request or a response.
|
|
7
|
+
* Headers allow the client and the satellite to pass additional information along with a request or a response.
|
|
8
|
+
* Some sets of headers can affect how the browser handles the page and its content.
|
|
9
|
+
* @interface StorageConfigHeader
|
|
7
10
|
*/
|
|
8
11
|
export interface StorageConfigHeader {
|
|
9
12
|
/**
|
|
10
13
|
* The glob pattern used to match files within the storage that these headers will apply to.
|
|
14
|
+
* @type {StorageConfigSourceGlob}
|
|
11
15
|
*/
|
|
12
16
|
source: StorageConfigSourceGlob;
|
|
13
17
|
/**
|
|
14
|
-
* An array of key-value pairs representing the headers to apply.
|
|
18
|
+
* An array of key-value pairs representing the headers to apply.
|
|
19
|
+
* Each pair includes the header name and its value.
|
|
15
20
|
* Example: `[["Cache-Control", "max-age=3600"], ["X-Custom-Header", "value"]]`
|
|
21
|
+
* @type {Array<[string, string]>}
|
|
16
22
|
*/
|
|
17
23
|
headers: [string, string][];
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
|
-
* You can utilize optional rewrites to display the same content for multiple URLs.
|
|
26
|
+
* You can utilize optional rewrites to display the same content for multiple URLs.
|
|
27
|
+
* Rewrites are especially useful when combined with pattern matching, allowing acceptance of any URL that matches the pattern.
|
|
28
|
+
* @interface StorageConfigRewrite
|
|
21
29
|
*/
|
|
22
30
|
export interface StorageConfigRewrite {
|
|
23
31
|
/**
|
|
24
|
-
* The glob pattern or specific path to match for incoming requests.
|
|
32
|
+
* The glob pattern or specific path to match for incoming requests.
|
|
33
|
+
* Matches are rewritten to the specified destination.
|
|
34
|
+
* @type {StorageConfigSourceGlob}
|
|
25
35
|
*/
|
|
26
36
|
source: StorageConfigSourceGlob;
|
|
27
37
|
/**
|
|
28
38
|
* The destination path or file to which matching requests should be rewritten.
|
|
39
|
+
* @type {string}
|
|
29
40
|
*/
|
|
30
41
|
destination: string;
|
|
31
42
|
}
|
|
32
43
|
/**
|
|
33
44
|
* Use a URL redirect to prevent broken links if you've moved a page or to shorten URLs.
|
|
45
|
+
* @interface StorageConfigRedirect
|
|
34
46
|
*/
|
|
35
47
|
export interface StorageConfigRedirect {
|
|
36
48
|
/**
|
|
37
49
|
* The glob pattern or specific path to match for incoming requests that should be redirected.
|
|
50
|
+
* @type {StorageConfigSourceGlob}
|
|
38
51
|
*/
|
|
39
52
|
source: StorageConfigSourceGlob;
|
|
40
53
|
/**
|
|
41
54
|
* The URL or path to which the request should be redirected.
|
|
55
|
+
* @type {string}
|
|
42
56
|
*/
|
|
43
57
|
location: string;
|
|
44
58
|
/**
|
|
45
59
|
* The HTTP status code to use for the redirect, typically 301 (permanent redirect) or 302 (temporary redirect).
|
|
60
|
+
* @type {301 | 302}
|
|
46
61
|
*/
|
|
47
62
|
code: 301 | 302;
|
|
48
63
|
}
|
|
49
64
|
/**
|
|
50
|
-
* Configures the
|
|
65
|
+
* Configures the hosting behavior of the storage.
|
|
66
|
+
* @interface StorageConfig
|
|
51
67
|
*/
|
|
52
68
|
export interface StorageConfig {
|
|
53
69
|
/**
|
|
54
70
|
* Optional array of `StorageConfigHeader` objects to define custom HTTP headers for specific files or patterns.
|
|
71
|
+
* @type {StorageConfigHeader[]}
|
|
72
|
+
* @optional
|
|
55
73
|
*/
|
|
56
74
|
headers?: StorageConfigHeader[];
|
|
57
75
|
/**
|
|
58
76
|
* Optional array of `StorageConfigRewrite` objects to define rewrite rules.
|
|
77
|
+
* @type {StorageConfigRewrite[]}
|
|
78
|
+
* @optional
|
|
59
79
|
*/
|
|
60
80
|
rewrites?: StorageConfigRewrite[];
|
|
61
81
|
/**
|
|
62
82
|
* Optional array of `StorageConfigRedirect` objects to define HTTP redirects.
|
|
83
|
+
* @type {StorageConfigRedirect[]}
|
|
84
|
+
* @optional
|
|
63
85
|
*/
|
|
64
86
|
redirects?: StorageConfigRedirect[];
|
|
65
87
|
/**
|
|
@@ -71,6 +93,8 @@ export interface StorageConfig {
|
|
|
71
93
|
* - `allow-any`: Allows iframe content from any origin.
|
|
72
94
|
*
|
|
73
95
|
* If not specified, then `deny` is used as default value.
|
|
96
|
+
* @type {'deny' | 'same-origin' | 'allow-any'}
|
|
97
|
+
* @optional
|
|
74
98
|
*/
|
|
75
99
|
iframe?: 'deny' | 'same-origin' | 'allow-any';
|
|
76
100
|
}
|
|
@@ -1,15 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the permission levels for read and write access.
|
|
3
|
+
* @typedef {'public' | 'private' | 'managed' | 'controllers'} PermissionText
|
|
4
|
+
*/
|
|
1
5
|
export type PermissionText = 'public' | 'private' | 'managed' | 'controllers';
|
|
6
|
+
/**
|
|
7
|
+
* Represents the memory types.
|
|
8
|
+
* @typedef {'heap' | 'stable'} MemoryText
|
|
9
|
+
*/
|
|
2
10
|
export type MemoryText = 'heap' | 'stable';
|
|
11
|
+
/**
|
|
12
|
+
* Represents the types of rules.
|
|
13
|
+
* @typedef {'db' | 'storage'} RulesType
|
|
14
|
+
*/
|
|
3
15
|
export type RulesType = 'db' | 'storage';
|
|
16
|
+
/**
|
|
17
|
+
* Represents a rule configuration for a collection.
|
|
18
|
+
* @interface Rule
|
|
19
|
+
*/
|
|
4
20
|
export interface Rule {
|
|
21
|
+
/**
|
|
22
|
+
* The name of the collection the rule applies to.
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
5
25
|
collection: string;
|
|
26
|
+
/**
|
|
27
|
+
* The permission level for read access.
|
|
28
|
+
* @type {PermissionText}
|
|
29
|
+
*/
|
|
6
30
|
read: PermissionText;
|
|
31
|
+
/**
|
|
32
|
+
* The permission level for write access.
|
|
33
|
+
* @type {PermissionText}
|
|
34
|
+
*/
|
|
7
35
|
write: PermissionText;
|
|
36
|
+
/**
|
|
37
|
+
* The type of memory allocated for the collection.
|
|
38
|
+
* @type {MemoryText}
|
|
39
|
+
*/
|
|
8
40
|
memory: MemoryText;
|
|
41
|
+
/**
|
|
42
|
+
* The timestamp when the rule was created.
|
|
43
|
+
* @type {bigint}
|
|
44
|
+
* @optional
|
|
45
|
+
*/
|
|
9
46
|
createdAt?: bigint;
|
|
47
|
+
/**
|
|
48
|
+
* The timestamp when the rule was last updated.
|
|
49
|
+
* @type {bigint}
|
|
50
|
+
* @optional
|
|
51
|
+
*/
|
|
10
52
|
updatedAt?: bigint;
|
|
53
|
+
/**
|
|
54
|
+
* The version of the rule.
|
|
55
|
+
* @type {bigint}
|
|
56
|
+
* @optional
|
|
57
|
+
* @description Must be provided when updating the rule to ensure the correct version is being updated.
|
|
58
|
+
*/
|
|
11
59
|
version?: bigint;
|
|
60
|
+
/**
|
|
61
|
+
* The maximum size of the collection in bytes.
|
|
62
|
+
* @type {number}
|
|
63
|
+
* @optional
|
|
64
|
+
*/
|
|
12
65
|
maxSize?: number;
|
|
66
|
+
/**
|
|
67
|
+
* The maximum capacity of the collection.
|
|
68
|
+
* @type {number}
|
|
69
|
+
* @optional
|
|
70
|
+
*/
|
|
13
71
|
maxCapacity?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates whether the permissions are mutable.
|
|
74
|
+
* @type {boolean}
|
|
75
|
+
*/
|
|
14
76
|
mutablePermissions: boolean;
|
|
15
77
|
}
|