@twin.org/blob-storage-connector-file 0.0.2-next.4 → 0.0.2-next.5

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.
@@ -18,7 +18,7 @@ class FileBlobStorageConnector {
18
18
  /**
19
19
  * Runtime name for the class.
20
20
  */
21
- CLASS_NAME = "FileBlobStorageConnector";
21
+ static CLASS_NAME = "FileBlobStorageConnector";
22
22
  /**
23
23
  * The directory to use for storage.
24
24
  * @internal
@@ -34,9 +34,9 @@ class FileBlobStorageConnector {
34
34
  * @param options The options for the connector.
35
35
  */
36
36
  constructor(options) {
37
- core.Guards.object(this.CLASS_NAME, "options", options);
38
- core.Guards.object(this.CLASS_NAME, "options.config", options.config);
39
- core.Guards.stringValue(this.CLASS_NAME, "options.config.directory", options.config.directory);
37
+ core.Guards.object(FileBlobStorageConnector.CLASS_NAME, "options", options);
38
+ core.Guards.object(FileBlobStorageConnector.CLASS_NAME, "options.config", options.config);
39
+ core.Guards.stringValue(FileBlobStorageConnector.CLASS_NAME, "options.config.directory", options.config.directory);
40
40
  this._directory = path.resolve(options.config.directory);
41
41
  this._extension = options.config.extension ?? ".blob";
42
42
  }
@@ -50,7 +50,7 @@ class FileBlobStorageConnector {
50
50
  if (!(await this.dirExists(this._directory))) {
51
51
  await nodeLogging?.log({
52
52
  level: "info",
53
- source: this.CLASS_NAME,
53
+ source: FileBlobStorageConnector.CLASS_NAME,
54
54
  message: "directoryCreating",
55
55
  data: {
56
56
  directory: this._directory
@@ -60,7 +60,7 @@ class FileBlobStorageConnector {
60
60
  await promises.mkdir(this._directory, { recursive: true });
61
61
  await nodeLogging?.log({
62
62
  level: "info",
63
- source: this.CLASS_NAME,
63
+ source: FileBlobStorageConnector.CLASS_NAME,
64
64
  message: "directoryCreated",
65
65
  data: {
66
66
  directory: this._directory
@@ -70,7 +70,7 @@ class FileBlobStorageConnector {
70
70
  catch (err) {
71
71
  await nodeLogging?.log({
72
72
  level: "error",
73
- source: this.CLASS_NAME,
73
+ source: FileBlobStorageConnector.CLASS_NAME,
74
74
  message: "directoryCreateFailed",
75
75
  data: {
76
76
  directory: this._directory
@@ -83,7 +83,7 @@ class FileBlobStorageConnector {
83
83
  else {
84
84
  await nodeLogging?.log({
85
85
  level: "info",
86
- source: this.CLASS_NAME,
86
+ source: FileBlobStorageConnector.CLASS_NAME,
87
87
  message: "directoryExists",
88
88
  data: {
89
89
  directory: this._directory
@@ -98,7 +98,7 @@ class FileBlobStorageConnector {
98
98
  * @returns The id of the stored blob in urn format.
99
99
  */
100
100
  async set(blob) {
101
- core.Guards.uint8Array(this.CLASS_NAME, "blob", blob);
101
+ core.Guards.uint8Array(FileBlobStorageConnector.CLASS_NAME, "blob", blob);
102
102
  try {
103
103
  if (!(await this.dirExists(this._directory))) {
104
104
  await promises.mkdir(this._directory);
@@ -109,7 +109,7 @@ class FileBlobStorageConnector {
109
109
  return `blob:${new core.Urn(FileBlobStorageConnector.NAMESPACE, id).toString()}`;
110
110
  }
111
111
  catch (err) {
112
- throw new core.GeneralError(this.CLASS_NAME, "setBlobFailed", undefined, err);
112
+ throw new core.GeneralError(FileBlobStorageConnector.CLASS_NAME, "setBlobFailed", undefined, err);
113
113
  }
114
114
  }
115
115
  /**
@@ -118,10 +118,10 @@ class FileBlobStorageConnector {
118
118
  * @returns The data for the blob if it can be found or undefined.
119
119
  */
120
120
  async get(id) {
121
- core.Urn.guard(this.CLASS_NAME, "id", id);
121
+ core.Urn.guard(FileBlobStorageConnector.CLASS_NAME, "id", id);
122
122
  const urnParsed = core.Urn.fromValidString(id);
123
123
  if (urnParsed.namespaceMethod() !== FileBlobStorageConnector.NAMESPACE) {
124
- throw new core.GeneralError(this.CLASS_NAME, "namespaceMismatch", {
124
+ throw new core.GeneralError(FileBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
125
125
  namespace: FileBlobStorageConnector.NAMESPACE,
126
126
  id
127
127
  });
@@ -134,7 +134,7 @@ class FileBlobStorageConnector {
134
134
  if (core.BaseError.isErrorCode(err, "ENOENT")) {
135
135
  return;
136
136
  }
137
- throw new core.GeneralError(this.CLASS_NAME, "getBlobFailed", { id }, err);
137
+ throw new core.GeneralError(FileBlobStorageConnector.CLASS_NAME, "getBlobFailed", { id }, err);
138
138
  }
139
139
  }
140
140
  /**
@@ -143,10 +143,10 @@ class FileBlobStorageConnector {
143
143
  * @returns True if the blob was found.
144
144
  */
145
145
  async remove(id) {
146
- core.Urn.guard(this.CLASS_NAME, "id", id);
146
+ core.Urn.guard(FileBlobStorageConnector.CLASS_NAME, "id", id);
147
147
  const urnParsed = core.Urn.fromValidString(id);
148
148
  if (urnParsed.namespaceMethod() !== FileBlobStorageConnector.NAMESPACE) {
149
- throw new core.GeneralError(this.CLASS_NAME, "namespaceMismatch", {
149
+ throw new core.GeneralError(FileBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
150
150
  namespace: FileBlobStorageConnector.NAMESPACE,
151
151
  id
152
152
  });
@@ -160,7 +160,7 @@ class FileBlobStorageConnector {
160
160
  if (core.BaseError.isErrorCode(err, "ENOENT")) {
161
161
  return false;
162
162
  }
163
- throw new core.GeneralError(this.CLASS_NAME, "removeBlobFailed", { id }, err);
163
+ throw new core.GeneralError(FileBlobStorageConnector.CLASS_NAME, "removeBlobFailed", { id }, err);
164
164
  }
165
165
  }
166
166
  /**
@@ -16,7 +16,7 @@ class FileBlobStorageConnector {
16
16
  /**
17
17
  * Runtime name for the class.
18
18
  */
19
- CLASS_NAME = "FileBlobStorageConnector";
19
+ static CLASS_NAME = "FileBlobStorageConnector";
20
20
  /**
21
21
  * The directory to use for storage.
22
22
  * @internal
@@ -32,9 +32,9 @@ class FileBlobStorageConnector {
32
32
  * @param options The options for the connector.
33
33
  */
34
34
  constructor(options) {
35
- Guards.object(this.CLASS_NAME, "options", options);
36
- Guards.object(this.CLASS_NAME, "options.config", options.config);
37
- Guards.stringValue(this.CLASS_NAME, "options.config.directory", options.config.directory);
35
+ Guards.object(FileBlobStorageConnector.CLASS_NAME, "options", options);
36
+ Guards.object(FileBlobStorageConnector.CLASS_NAME, "options.config", options.config);
37
+ Guards.stringValue(FileBlobStorageConnector.CLASS_NAME, "options.config.directory", options.config.directory);
38
38
  this._directory = path.resolve(options.config.directory);
39
39
  this._extension = options.config.extension ?? ".blob";
40
40
  }
@@ -48,7 +48,7 @@ class FileBlobStorageConnector {
48
48
  if (!(await this.dirExists(this._directory))) {
49
49
  await nodeLogging?.log({
50
50
  level: "info",
51
- source: this.CLASS_NAME,
51
+ source: FileBlobStorageConnector.CLASS_NAME,
52
52
  message: "directoryCreating",
53
53
  data: {
54
54
  directory: this._directory
@@ -58,7 +58,7 @@ class FileBlobStorageConnector {
58
58
  await mkdir(this._directory, { recursive: true });
59
59
  await nodeLogging?.log({
60
60
  level: "info",
61
- source: this.CLASS_NAME,
61
+ source: FileBlobStorageConnector.CLASS_NAME,
62
62
  message: "directoryCreated",
63
63
  data: {
64
64
  directory: this._directory
@@ -68,7 +68,7 @@ class FileBlobStorageConnector {
68
68
  catch (err) {
69
69
  await nodeLogging?.log({
70
70
  level: "error",
71
- source: this.CLASS_NAME,
71
+ source: FileBlobStorageConnector.CLASS_NAME,
72
72
  message: "directoryCreateFailed",
73
73
  data: {
74
74
  directory: this._directory
@@ -81,7 +81,7 @@ class FileBlobStorageConnector {
81
81
  else {
82
82
  await nodeLogging?.log({
83
83
  level: "info",
84
- source: this.CLASS_NAME,
84
+ source: FileBlobStorageConnector.CLASS_NAME,
85
85
  message: "directoryExists",
86
86
  data: {
87
87
  directory: this._directory
@@ -96,7 +96,7 @@ class FileBlobStorageConnector {
96
96
  * @returns The id of the stored blob in urn format.
97
97
  */
98
98
  async set(blob) {
99
- Guards.uint8Array(this.CLASS_NAME, "blob", blob);
99
+ Guards.uint8Array(FileBlobStorageConnector.CLASS_NAME, "blob", blob);
100
100
  try {
101
101
  if (!(await this.dirExists(this._directory))) {
102
102
  await mkdir(this._directory);
@@ -107,7 +107,7 @@ class FileBlobStorageConnector {
107
107
  return `blob:${new Urn(FileBlobStorageConnector.NAMESPACE, id).toString()}`;
108
108
  }
109
109
  catch (err) {
110
- throw new GeneralError(this.CLASS_NAME, "setBlobFailed", undefined, err);
110
+ throw new GeneralError(FileBlobStorageConnector.CLASS_NAME, "setBlobFailed", undefined, err);
111
111
  }
112
112
  }
113
113
  /**
@@ -116,10 +116,10 @@ class FileBlobStorageConnector {
116
116
  * @returns The data for the blob if it can be found or undefined.
117
117
  */
118
118
  async get(id) {
119
- Urn.guard(this.CLASS_NAME, "id", id);
119
+ Urn.guard(FileBlobStorageConnector.CLASS_NAME, "id", id);
120
120
  const urnParsed = Urn.fromValidString(id);
121
121
  if (urnParsed.namespaceMethod() !== FileBlobStorageConnector.NAMESPACE) {
122
- throw new GeneralError(this.CLASS_NAME, "namespaceMismatch", {
122
+ throw new GeneralError(FileBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
123
123
  namespace: FileBlobStorageConnector.NAMESPACE,
124
124
  id
125
125
  });
@@ -132,7 +132,7 @@ class FileBlobStorageConnector {
132
132
  if (BaseError.isErrorCode(err, "ENOENT")) {
133
133
  return;
134
134
  }
135
- throw new GeneralError(this.CLASS_NAME, "getBlobFailed", { id }, err);
135
+ throw new GeneralError(FileBlobStorageConnector.CLASS_NAME, "getBlobFailed", { id }, err);
136
136
  }
137
137
  }
138
138
  /**
@@ -141,10 +141,10 @@ class FileBlobStorageConnector {
141
141
  * @returns True if the blob was found.
142
142
  */
143
143
  async remove(id) {
144
- Urn.guard(this.CLASS_NAME, "id", id);
144
+ Urn.guard(FileBlobStorageConnector.CLASS_NAME, "id", id);
145
145
  const urnParsed = Urn.fromValidString(id);
146
146
  if (urnParsed.namespaceMethod() !== FileBlobStorageConnector.NAMESPACE) {
147
- throw new GeneralError(this.CLASS_NAME, "namespaceMismatch", {
147
+ throw new GeneralError(FileBlobStorageConnector.CLASS_NAME, "namespaceMismatch", {
148
148
  namespace: FileBlobStorageConnector.NAMESPACE,
149
149
  id
150
150
  });
@@ -158,7 +158,7 @@ class FileBlobStorageConnector {
158
158
  if (BaseError.isErrorCode(err, "ENOENT")) {
159
159
  return false;
160
160
  }
161
- throw new GeneralError(this.CLASS_NAME, "removeBlobFailed", { id }, err);
161
+ throw new GeneralError(FileBlobStorageConnector.CLASS_NAME, "removeBlobFailed", { id }, err);
162
162
  }
163
163
  }
164
164
  /**
@@ -11,7 +11,7 @@ export declare class FileBlobStorageConnector implements IBlobStorageConnector {
11
11
  /**
12
12
  * Runtime name for the class.
13
13
  */
14
- readonly CLASS_NAME: string;
14
+ static readonly CLASS_NAME: string;
15
15
  /**
16
16
  * Create a new instance of FileBlobStorageConnector.
17
17
  * @param options The options for the connector.
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @twin.org/blob-storage-connector-file - Changelog
2
2
 
3
+ ## [0.0.2-next.5](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-file-v0.0.2-next.4...blob-storage-connector-file-v0.0.2-next.5) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([f20fcec](https://github.com/twinfoundation/blob-storage/commit/f20fceced91e39a0c9edb770b2e43ce944c92f3c))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/blob-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
16
+
3
17
  ## [0.0.2-next.4](https://github.com/twinfoundation/blob-storage/compare/blob-storage-connector-file-v0.0.2-next.3...blob-storage-connector-file-v0.0.2-next.4) (2025-10-02)
4
18
 
5
19
 
@@ -38,14 +38,10 @@ The namespace for the items.
38
38
 
39
39
  ### CLASS\_NAME
40
40
 
41
- > `readonly` **CLASS\_NAME**: `string`
41
+ > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
43
43
  Runtime name for the class.
44
44
 
45
- #### Implementation of
46
-
47
- `IBlobStorageConnector.CLASS_NAME`
48
-
49
45
  ## Methods
50
46
 
51
47
  ### bootstrap()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/blob-storage-connector-file",
3
- "version": "0.0.2-next.4",
3
+ "version": "0.0.2-next.5",
4
4
  "description": "Blob Storage connector implementation using file storage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/blob-storage-models": "0.0.2-next.4",
17
+ "@twin.org/blob-storage-models": "0.0.2-next.5",
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/crypto": "next",
20
20
  "@twin.org/logging-models": "next",
@@ -52,5 +52,9 @@
52
52
  "connector",
53
53
  "adapter",
54
54
  "integration"
55
- ]
55
+ ],
56
+ "bugs": {
57
+ "url": "git+https://github.com/twinfoundation/blob-storage/issues"
58
+ },
59
+ "homepage": "https://twindev.org"
56
60
  }