@junobuild/core-peer 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,149 @@
1
1
  import type { AssetNoContent } from '../../declarations/satellite/satellite.did';
2
2
  import type { ListResults } from './list.types';
3
+ /**
4
+ * Represents the encoding details of an asset.
5
+ * @interface
6
+ */
3
7
  export interface AssetEncoding {
8
+ /**
9
+ * The timestamp when the encoding was modified.
10
+ * @type {bigint}
11
+ */
4
12
  modified: bigint;
13
+ /**
14
+ * The SHA-256 hash of the encoding.
15
+ * @type {string}
16
+ */
5
17
  sha256: string;
18
+ /**
19
+ * The total length of the encoding.
20
+ * @type {bigint}
21
+ */
6
22
  total_length: bigint;
7
23
  }
24
+ /**
25
+ * Represents the key details of an asset.
26
+ * @interface
27
+ */
8
28
  export interface AssetKey {
29
+ /**
30
+ * The full path of the asset, i.e., URL.pathname. Except for the dApps assets (HTML, JS, etc.), the full path must start with `/collection/`.
31
+ * @type {string}
32
+ */
9
33
  fullPath: string;
34
+ /**
35
+ * The name of the asset.
36
+ * @type {string}
37
+ */
10
38
  name: string;
39
+ /**
40
+ * The download URL of the asset.
41
+ * @type {string}
42
+ */
11
43
  downloadUrl: string;
12
44
  }
45
+ /**
46
+ * Type representing the possible encoding types.
47
+ * @typedef {('identity' | 'gzip' | 'compress' | 'deflate' | 'br')} ENCODING_TYPE
48
+ */
13
49
  export type ENCODING_TYPE = 'identity' | 'gzip' | 'compress' | 'deflate' | 'br';
50
+ /**
51
+ * Represents an asset with its key details, encodings, and metadata.
52
+ * @interface
53
+ * @extends {AssetKey}
54
+ */
14
55
  export interface Asset extends AssetKey {
56
+ /**
57
+ * An optional description of the asset. A field which can be used to filter assets when listing those.
58
+ * @type {string}
59
+ */
15
60
  description?: string;
61
+ /**
62
+ * An optional token associated with the asset. Tokens are used to protect assets on the web. If a token is provided, the asset is delivered on the web only if the query parameter `token` is provided with a matching value.
63
+ * @type {string}
64
+ */
16
65
  token?: string;
66
+ /**
67
+ * The headers associated with the asset.
68
+ * @type {[string, string][]}
69
+ */
17
70
  headers: [string, string][];
71
+ /**
72
+ * The encodings of the asset.
73
+ * @type {Record<ENCODING_TYPE, AssetEncoding>}
74
+ */
18
75
  encodings: Record<ENCODING_TYPE, AssetEncoding>;
76
+ /**
77
+ * The owner of the asset.
78
+ * @type {string}
79
+ */
19
80
  owner?: string;
81
+ /**
82
+ * The timestamp when the asset was created.
83
+ * @type {bigint}
84
+ */
20
85
  created_at?: bigint;
86
+ /**
87
+ * The timestamp when the asset was last updated.
88
+ * @type {bigint}
89
+ */
21
90
  updated_at?: bigint;
22
91
  }
92
+ /**
93
+ * Represents a collection of assets with pagination details.
94
+ * @interface
95
+ * @extends {Pick<ListResults<AssetNoContent>, 'items_length' | 'items_page' | 'matches_length' | 'matches_pages'>}
96
+ */
23
97
  export interface Assets extends Pick<ListResults<AssetNoContent>, 'items_length' | 'items_page' | 'matches_length' | 'matches_pages'> {
98
+ /**
99
+ * The collection of assets.
100
+ * @type {Asset[]}
101
+ */
24
102
  assets: Asset[];
25
103
  }
104
+ /**
105
+ * Represents the details required to store an asset.
106
+ * @interface
107
+ */
26
108
  export interface Storage {
109
+ /**
110
+ * The filename of the asset.
111
+ * @type {string}
112
+ */
27
113
  filename: string;
114
+ /**
115
+ * The data of the asset.
116
+ * @type {Blob}
117
+ */
28
118
  data: Blob;
119
+ /**
120
+ * The collection to which the asset belongs.
121
+ * @type {string}
122
+ */
29
123
  collection: string;
124
+ /**
125
+ * The full path of the asset, i.e., URL.pathname. Except for the dApps assets (HTML, JS, etc.), the full path must start with `/collection/`.
126
+ * @type {string}
127
+ */
30
128
  fullPath?: string;
129
+ /**
130
+ * The headers associated with the asset.
131
+ * @type {[string, string][]}
132
+ */
31
133
  headers?: [string, string][];
134
+ /**
135
+ * An optional token associated with the asset. Tokens are used to protect assets on the web. If a token is provided, the asset is delivered on the web only if the query parameter `token` is provided with a matching value.
136
+ * @type {string}
137
+ */
32
138
  token?: string;
139
+ /**
140
+ * The encoding type of the asset.
141
+ * @type {ENCODING_TYPE}
142
+ */
33
143
  encoding?: ENCODING_TYPE;
144
+ /**
145
+ * An optional description of the asset. A field which can be used to filter assets when listing those.
146
+ * @type {string}
147
+ */
34
148
  description?: string;
35
149
  }
@@ -1 +1,6 @@
1
+ /**
2
+ * Represents a function that unsubscribes from an event or a subscription.
3
+ * @typedef {Function} Unsubscribe
4
+ * @returns {void}
5
+ */
1
6
  export type Unsubscribe = () => void;
@@ -0,0 +1,2 @@
1
+ export declare const envSatelliteId: () => string | undefined;
2
+ export declare const envContainer: () => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/core-peer",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "JavaScript core client for Juno minus DFINITY agent-js dependencies",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",