@junobuild/config 0.0.1 → 0.0.2
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 +1 -100
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/dev/config.d.ts +6 -0
- package/dist/types/dev/juno.dev.config.d.ts +17 -0
- package/dist/types/index.d.ts +9 -10
- package/dist/types/mainnet/config.d.ts +7 -0
- package/dist/types/mainnet/juno.config.d.ts +11 -0
- package/dist/types/mainnet/juno.env.d.ts +4 -0
- package/dist/types/{types/juno.config.d.ts → mainnet/satellite.config.d.ts} +25 -15
- package/dist/types/types/rules.d.ts +13 -0
- package/dist/types/utils/ts.utils.d.ts +6 -0
- package/package.json +1 -1
- package/dist/types/types/juno.env.d.ts +0 -3
- /package/dist/types/{types → mainnet}/storage.config.d.ts +0 -0
package/README.md
CHANGED
|
@@ -6,104 +6,15 @@
|
|
|
6
6
|
[npm-license]: https://img.shields.io/npm/l/@junobuild/config
|
|
7
7
|
[npm-license-url]: https://github.com/junobuild/juno-js/blob/main/LICENSE
|
|
8
8
|
|
|
9
|
-
# Juno
|
|
9
|
+
# Juno Config
|
|
10
10
|
|
|
11
11
|
Configuration options for [Juno] CLI.
|
|
12
12
|
|
|
13
13
|
<!-- TSDOC_START -->
|
|
14
14
|
|
|
15
|
-
### :tropical_drink: Interfaces
|
|
16
|
-
|
|
17
|
-
- [StorageConfigHeader](#gear-storageconfigheader)
|
|
18
|
-
- [StorageConfigRewrite](#gear-storageconfigrewrite)
|
|
19
|
-
- [StorageConfigRedirect](#gear-storageconfigredirect)
|
|
20
|
-
- [StorageConfig](#gear-storageconfig)
|
|
21
|
-
- [SatelliteAssertions](#gear-satelliteassertions)
|
|
22
|
-
- [SatelliteConfig](#gear-satelliteconfig)
|
|
23
|
-
- [OrbiterConfig](#gear-orbiterconfig)
|
|
24
|
-
- [JunoConfig](#gear-junoconfig)
|
|
25
|
-
- [JunoConfigEnv](#gear-junoconfigenv)
|
|
26
|
-
|
|
27
|
-
#### :gear: StorageConfigHeader
|
|
28
|
-
|
|
29
|
-
Headers allow the client and the satellite to pass additional information along with a request or a response. Some sets of headers can affect how the browser handles the page and its content.
|
|
30
|
-
|
|
31
|
-
| Property | Type | Description |
|
|
32
|
-
| --------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
-
| `source` | `string` | The glob pattern used to match files within the storage that these headers will apply to. |
|
|
34
|
-
| `headers` | `[string, string][]` | An array of key-value pairs representing the headers to apply. Each pair includes the header name and its value.Example: `[["Cache-Control", "max-age=3600"], ["X-Custom-Header", "value"]]` |
|
|
35
|
-
|
|
36
|
-
#### :gear: StorageConfigRewrite
|
|
37
|
-
|
|
38
|
-
You can utilize optional rewrites to display the same content for multiple URLs. Rewrites are especially useful when combined with pattern matching, allowing acceptance of any URL that matches the pattern.
|
|
39
|
-
|
|
40
|
-
| Property | Type | Description |
|
|
41
|
-
| ------------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
-
| `source` | `string` | The glob pattern or specific path to match for incoming requests. Matches are rewritten to the specified destination. |
|
|
43
|
-
| `destination` | `string` | The destination path or file to which matching requests should be rewritten. |
|
|
44
|
-
|
|
45
|
-
#### :gear: StorageConfigRedirect
|
|
46
|
-
|
|
47
|
-
Use a URL redirect to prevent broken links if you've moved a page or to shorten URLs.
|
|
48
|
-
|
|
49
|
-
| Property | Type | Description |
|
|
50
|
-
| ---------- | ------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
51
|
-
| `source` | `string` | The glob pattern or specific path to match for incoming requests that should be redirected. |
|
|
52
|
-
| `location` | `string` | The URL or path to which the request should be redirected. |
|
|
53
|
-
| `code` | `301 or 302` | The HTTP status code to use for the redirect, typically 301 (permanent redirect) or 302 (temporary redirect). |
|
|
54
|
-
|
|
55
|
-
#### :gear: StorageConfig
|
|
56
|
-
|
|
57
|
-
Configures the Hosting behavior of the Storage.
|
|
58
|
-
|
|
59
|
-
| Property | Type | Description |
|
|
60
|
-
| ----------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
-
| `headers` | `StorageConfigHeader[]` | Optional array of `StorageConfigHeader` objects to define custom HTTP headers for specific files or patterns. |
|
|
62
|
-
| `rewrites` | `StorageConfigRewrite[]` | Optional array of `StorageConfigRewrite` objects to define rewrite rules. |
|
|
63
|
-
| `redirects` | `StorageConfigRedirect[]` | Optional array of `StorageConfigRedirect` objects to define HTTP redirects. |
|
|
64
|
-
| `iframe` | `"deny" or "same-origin" or "allow-any"` | For security reasons and to prevent click-jacking attacks, dapps deployed with Juno are, by default, set to deny embedding in other sites.Options are:- `deny`: Prevents any content from being displayed in an iframe.- `same-origin`: Allows iframe content from the same origin as the page.- `allow-any`: Allows iframe content from any origin.If not specified, then `deny` is used as default value. |
|
|
65
|
-
|
|
66
|
-
#### :gear: SatelliteAssertions
|
|
67
|
-
|
|
68
|
-
| Property | Type | Description |
|
|
69
|
-
| ------------ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
70
|
-
| `heapMemory` | `number or boolean` | Configuration for the heap memory size check, which can be:- `true` to enable the check with a default threshold of 900MB,- `false` to disable the heap memory size check,- A `number` to specify a custom threshold in MB (megabytes) for the heap memory size check.If not specified, then `true` is used as default value. |
|
|
71
|
-
|
|
72
|
-
#### :gear: SatelliteConfig
|
|
73
|
-
|
|
74
|
-
| Property | Type | Description |
|
|
75
|
-
| ------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
76
|
-
| `satelliteId` | `string` | The unique identifier (ID) of the satellite where the application will be deployed. |
|
|
77
|
-
| `source` | `string` | Specifies the directory from which to deploy to storage. Defaults to 'build'.For instance, if `npm run build` outputs files to a `dist` folder, use `source: 'dist'`. |
|
|
78
|
-
| `storage` | `StorageConfig` | Optional configuration parameters for the satellite, affecting the operational behavior of its Storage.Changes to these parameters must be applied manually afterwards using `juno config` commands. |
|
|
79
|
-
| `ignore` | `string[]` | Specifies files or patterns to ignore during deployment, using glob patterns similar to those in .gitignore. |
|
|
80
|
-
| `gzip` | `string or false` | Controls the Gzip compression optimization for files in the source folder. By default, it targets JavaScript (js), ES Module (mjs), and CSS (css) files.You can disable this by setting it to `false` or customize it with a different file matching pattern using glob syntax. |
|
|
81
|
-
| `encoding` | `[string, ENCODING_TYPE][]` | Customizes file encoding mapping for HTTP response headers `Content-Encoding` based on file extension:- `.Z` for compress,- `.gz` for gzip,- `.br` for brotli,- `.zlib` for deflate,- anything else defaults to `identity`.The "encoding" attribute allows overriding default mappings with an array of glob patterns and encoding types. |
|
|
82
|
-
| `assertions` | `SatelliteAssertions` | Optional configurations to override default assertions made by the CLI regarding satellite deployment conditions. |
|
|
83
|
-
|
|
84
|
-
#### :gear: OrbiterConfig
|
|
85
|
-
|
|
86
|
-
| Property | Type | Description |
|
|
87
|
-
| ----------- | -------- | ----------------------------------------------- |
|
|
88
|
-
| `orbiterId` | `string` | The identifier of the orbiter used in the dApp. |
|
|
89
|
-
|
|
90
|
-
#### :gear: JunoConfig
|
|
91
|
-
|
|
92
|
-
| Property | Type | Description |
|
|
93
|
-
| ----------- | ----------------- | ----------- |
|
|
94
|
-
| `satellite` | `SatelliteConfig` | |
|
|
95
|
-
| `orbiter` | `OrbiterConfig` | |
|
|
96
|
-
|
|
97
|
-
#### :gear: JunoConfigEnv
|
|
98
|
-
|
|
99
|
-
| Property | Type | Description |
|
|
100
|
-
| -------- | -------- | ----------- |
|
|
101
|
-
| `mode` | `string` | |
|
|
102
|
-
|
|
103
15
|
### :cocktail: Types
|
|
104
16
|
|
|
105
17
|
- [ENCODING_TYPE](#gear-encoding_type)
|
|
106
|
-
- [StorageConfigSourceGlob](#gear-storageconfigsourceglob)
|
|
107
18
|
|
|
108
19
|
#### :gear: ENCODING_TYPE
|
|
109
20
|
|
|
@@ -113,16 +24,6 @@ Configures the Hosting behavior of the Storage.
|
|
|
113
24
|
|
|
114
25
|
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/types/encoding.ts#L1)
|
|
115
26
|
|
|
116
|
-
#### :gear: StorageConfigSourceGlob
|
|
117
|
-
|
|
118
|
-
Represents a glob pattern for matching files in the storage configuration.
|
|
119
|
-
|
|
120
|
-
| Type | Type |
|
|
121
|
-
| ------------------------- | ---- |
|
|
122
|
-
| `StorageConfigSourceGlob` | |
|
|
123
|
-
|
|
124
|
-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/config/src/types/storage.config.ts#L4)
|
|
125
|
-
|
|
126
27
|
<!-- TSDOC_END -->
|
|
127
28
|
|
|
128
29
|
## License
|
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function o(n){return n}export{o as
|
|
1
|
+
function o(n){return n}function f(n){return n}export{f as defineConfig,o as defineDevConfig};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["defineConfig", "config"]
|
|
3
|
+
"sources": ["../../src/dev/config.ts", "../../src/mainnet/config.ts"],
|
|
4
|
+
"sourcesContent": ["import type {JunoDevConfig} from './juno.dev.config';\n\nexport type JunoDevConfigFn = () => JunoDevConfig;\n\nexport type JunoDevConfigFnOrObject = JunoDevConfig | JunoDevConfigFn;\n\nexport function defineDevConfig(config: JunoDevConfig): JunoDevConfig;\nexport function defineDevConfig(config: JunoDevConfigFn): JunoDevConfigFn;\nexport function defineDevConfig(config: JunoDevConfigFnOrObject): JunoDevConfigFnOrObject;\nexport function defineDevConfig(config: JunoDevConfigFnOrObject): JunoDevConfigFnOrObject {\n return config;\n}\n", "import type {JunoConfig} from './juno.config';\nimport type {JunoConfigEnv} from './juno.env';\n\nexport type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig;\n\nexport type JunoConfigFnOrObject = JunoConfig | JunoConfigFn;\n\nexport function defineConfig(config: JunoConfig): JunoConfig;\nexport function defineConfig(config: JunoConfigFn): JunoConfigFn;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject {\n return config;\n}\n"],
|
|
5
|
+
"mappings": "AASO,SAASA,EAAgBC,EAA0D,CACxF,OAAOA,CACT,CCDO,SAASC,EAAaC,EAAoD,CAC/E,OAAOA,CACT",
|
|
6
|
+
"names": ["defineDevConfig", "config", "defineConfig", "config"]
|
|
7
7
|
}
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as topLevelCreateRequire } from 'module';
|
|
2
2
|
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
-
function o(n){return n}export{o as
|
|
3
|
+
function o(n){return n}function f(n){return n}export{f as defineConfig,o as defineDevConfig};
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;
|
|
6
|
-
"names": ["defineConfig", "config"]
|
|
3
|
+
"sources": ["../../src/dev/config.ts", "../../src/mainnet/config.ts"],
|
|
4
|
+
"sourcesContent": ["import type {JunoDevConfig} from './juno.dev.config';\n\nexport type JunoDevConfigFn = () => JunoDevConfig;\n\nexport type JunoDevConfigFnOrObject = JunoDevConfig | JunoDevConfigFn;\n\nexport function defineDevConfig(config: JunoDevConfig): JunoDevConfig;\nexport function defineDevConfig(config: JunoDevConfigFn): JunoDevConfigFn;\nexport function defineDevConfig(config: JunoDevConfigFnOrObject): JunoDevConfigFnOrObject;\nexport function defineDevConfig(config: JunoDevConfigFnOrObject): JunoDevConfigFnOrObject {\n return config;\n}\n", "import type {JunoConfig} from './juno.config';\nimport type {JunoConfigEnv} from './juno.env';\n\nexport type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig;\n\nexport type JunoConfigFnOrObject = JunoConfig | JunoConfigFn;\n\nexport function defineConfig(config: JunoConfig): JunoConfig;\nexport function defineConfig(config: JunoConfigFn): JunoConfigFn;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject {\n return config;\n}\n"],
|
|
5
|
+
"mappings": ";;AASO,SAASA,EAAgBC,EAA0D,CACxF,OAAOA,CACT,CCDO,SAASC,EAAaC,EAAoD,CAC/E,OAAOA,CACT",
|
|
6
|
+
"names": ["defineDevConfig", "config", "defineConfig", "config"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JunoDevConfig } from './juno.dev.config';
|
|
2
|
+
export type JunoDevConfigFn = () => JunoDevConfig;
|
|
3
|
+
export type JunoDevConfigFnOrObject = JunoDevConfig | JunoDevConfigFn;
|
|
4
|
+
export declare function defineDevConfig(config: JunoDevConfig): JunoDevConfig;
|
|
5
|
+
export declare function defineDevConfig(config: JunoDevConfigFn): JunoDevConfigFn;
|
|
6
|
+
export declare function defineDevConfig(config: JunoDevConfigFnOrObject): JunoDevConfigFnOrObject;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Rule } from '../types/rules';
|
|
2
|
+
export type SatelliteDevCollection = Omit<Rule, 'created_at' | 'updated_at'>;
|
|
3
|
+
export interface SatelliteDevCollections {
|
|
4
|
+
db?: SatelliteDevCollection[];
|
|
5
|
+
storage?: SatelliteDevCollection[];
|
|
6
|
+
}
|
|
7
|
+
export interface SatelliteDevController {
|
|
8
|
+
id: string;
|
|
9
|
+
scope: 'write' | 'admin';
|
|
10
|
+
}
|
|
11
|
+
export interface SatelliteDevConfig {
|
|
12
|
+
collections: SatelliteDevCollections;
|
|
13
|
+
controllers?: SatelliteDevController[];
|
|
14
|
+
}
|
|
15
|
+
export interface JunoDevConfig {
|
|
16
|
+
satellite: SatelliteDevConfig;
|
|
17
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
export type * from './dev/juno.dev.config';
|
|
2
|
+
export type * from './mainnet/juno.config';
|
|
3
|
+
export type * from './mainnet/juno.env';
|
|
4
|
+
export type * from './mainnet/satellite.config';
|
|
5
|
+
export type * from './mainnet/storage.config';
|
|
1
6
|
export type * from './types/encoding';
|
|
2
|
-
export type * from './types/
|
|
3
|
-
export type * from './
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
import type { JunoConfigEnv } from './types/juno.env';
|
|
7
|
-
export type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig;
|
|
8
|
-
export type JunoConfigFnOrObject = JunoConfig | JunoConfigFn;
|
|
9
|
-
export declare function defineConfig(config: JunoConfig): JunoConfig;
|
|
10
|
-
export declare function defineConfig(config: JunoConfigFn): JunoConfigFn;
|
|
11
|
-
export declare function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject;
|
|
7
|
+
export type * from './types/rules';
|
|
8
|
+
export type * from './utils/ts.utils';
|
|
9
|
+
export * from './dev/config';
|
|
10
|
+
export * from './mainnet/config';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JunoConfig } from './juno.config';
|
|
2
|
+
import type { JunoConfigEnv } from './juno.env';
|
|
3
|
+
export type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig;
|
|
4
|
+
export type JunoConfigFnOrObject = JunoConfig | JunoConfigFn;
|
|
5
|
+
export declare function defineConfig(config: JunoConfig): JunoConfig;
|
|
6
|
+
export declare function defineConfig(config: JunoConfigFn): JunoConfigFn;
|
|
7
|
+
export declare function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SatelliteConfig } from './satellite.config';
|
|
2
|
+
export interface OrbiterConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The identifier of the orbiter used in the dApp.
|
|
5
|
+
*/
|
|
6
|
+
orbiterId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface JunoConfig {
|
|
9
|
+
satellite: SatelliteConfig;
|
|
10
|
+
orbiter?: OrbiterConfig;
|
|
11
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { ENCODING_TYPE } from '
|
|
1
|
+
import type { ENCODING_TYPE } from '../types/encoding';
|
|
2
|
+
import type { Either } from '../utils/ts.utils';
|
|
3
|
+
import type { JunoConfigMode } from './juno.env';
|
|
2
4
|
import type { StorageConfig } from './storage.config';
|
|
3
5
|
export interface SatelliteAssertions {
|
|
4
6
|
/**
|
|
@@ -11,14 +13,32 @@ export interface SatelliteAssertions {
|
|
|
11
13
|
*/
|
|
12
14
|
heapMemory?: number | boolean;
|
|
13
15
|
}
|
|
14
|
-
export interface
|
|
16
|
+
export interface SatelliteId {
|
|
15
17
|
/**
|
|
16
|
-
* The unique identifier (ID) of the satellite
|
|
18
|
+
* The unique identifier (ID) of the satellite for this application.
|
|
17
19
|
*/
|
|
18
20
|
satelliteId: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SatelliteIds {
|
|
23
|
+
/**
|
|
24
|
+
* A mapping of satellite identifiers (IDs) to different configurations based on the mode of the application.
|
|
25
|
+
*
|
|
26
|
+
* This allows the application to use different satellite IDs, such as production, staging, etc.
|
|
27
|
+
*
|
|
28
|
+
* Example:
|
|
29
|
+
* {
|
|
30
|
+
* "production": "xo2hm-lqaaa-aaaal-ab3oa-cai",
|
|
31
|
+
* "staging": "gl6nx-5maaa-aaaaa-qaaqq-cai"
|
|
32
|
+
* }
|
|
33
|
+
*/
|
|
34
|
+
satellitesIds: Record<JunoConfigMode, string>;
|
|
35
|
+
}
|
|
36
|
+
export type SatelliteConfig = Either<SatelliteId, SatelliteIds> & {
|
|
19
37
|
/**
|
|
20
|
-
* Specifies the directory from which to deploy to storage.
|
|
38
|
+
* Specifies the directory from which to deploy to storage.
|
|
21
39
|
* For instance, if `npm run build` outputs files to a `dist` folder, use `source: 'dist'`.
|
|
40
|
+
*
|
|
41
|
+
* @default `build`
|
|
22
42
|
*/
|
|
23
43
|
source?: string;
|
|
24
44
|
/**
|
|
@@ -49,14 +69,4 @@ export interface SatelliteConfig {
|
|
|
49
69
|
* Optional configurations to override default assertions made by the CLI regarding satellite deployment conditions.
|
|
50
70
|
*/
|
|
51
71
|
assertions?: SatelliteAssertions;
|
|
52
|
-
}
|
|
53
|
-
export interface OrbiterConfig {
|
|
54
|
-
/**
|
|
55
|
-
* The identifier of the orbiter used in the dApp.
|
|
56
|
-
*/
|
|
57
|
-
orbiterId: string;
|
|
58
|
-
}
|
|
59
|
-
export interface JunoConfig {
|
|
60
|
-
satellite: SatelliteConfig;
|
|
61
|
-
orbiter?: OrbiterConfig;
|
|
62
|
-
}
|
|
72
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type PermissionText = 'public' | 'private' | 'managed' | 'controllers';
|
|
2
|
+
export type MemoryText = 'Heap' | 'Stable';
|
|
3
|
+
export type RulesType = 'db' | 'storage';
|
|
4
|
+
export interface Rule {
|
|
5
|
+
collection: string;
|
|
6
|
+
read: PermissionText;
|
|
7
|
+
write: PermissionText;
|
|
8
|
+
memory: MemoryText;
|
|
9
|
+
created_at?: bigint;
|
|
10
|
+
updated_at?: bigint;
|
|
11
|
+
max_size?: number;
|
|
12
|
+
mutablePermissions: boolean;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
File without changes
|