@twin.org/nft-service 0.0.2-next.6 → 0.0.2-next.8

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.
@@ -307,15 +307,15 @@ async function nftUpdate(httpRequestContext, componentName, request) {
307
307
  * Service for performing NFT operations to a connector.
308
308
  */
309
309
  class NftService {
310
+ /**
311
+ * Runtime name for the class.
312
+ */
313
+ static CLASS_NAME = "NftService";
310
314
  /**
311
315
  * The namespace supported by the nft service.
312
316
  * @internal
313
317
  */
314
318
  static _NAMESPACE = "nft";
315
- /**
316
- * Runtime name for the class.
317
- */
318
- CLASS_NAME = "NftService";
319
319
  /**
320
320
  * The default namespace for the connector to use.
321
321
  * @internal
@@ -328,7 +328,7 @@ class NftService {
328
328
  constructor(options) {
329
329
  const names = nftModels.NftConnectorFactory.names();
330
330
  if (names.length === 0) {
331
- throw new core.GeneralError(this.CLASS_NAME, "noConnectors");
331
+ throw new core.GeneralError(NftService.CLASS_NAME, "noConnectors");
332
332
  }
333
333
  this._defaultNamespace = options?.config?.defaultNamespace ?? names[0];
334
334
  }
@@ -342,8 +342,8 @@ class NftService {
342
342
  * @returns The id of the created NFT in urn format.
343
343
  */
344
344
  async mint(tag, immutableMetadata, metadata, namespace, identity) {
345
- core.Guards.stringValue(this.CLASS_NAME, "tag", tag);
346
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
345
+ core.Guards.stringValue(NftService.CLASS_NAME, "tag", tag);
346
+ core.Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
347
347
  try {
348
348
  const connectorNamespace = namespace ?? this._defaultNamespace;
349
349
  const nftConnector = nftModels.NftConnectorFactory.get(connectorNamespace);
@@ -351,7 +351,7 @@ class NftService {
351
351
  return nftUrn;
352
352
  }
353
353
  catch (error) {
354
- throw new core.GeneralError(this.CLASS_NAME, "mintFailed", undefined, error);
354
+ throw new core.GeneralError(NftService.CLASS_NAME, "mintFailed", undefined, error);
355
355
  }
356
356
  }
357
357
  /**
@@ -361,13 +361,13 @@ class NftService {
361
361
  * @returns The data for the NFT.
362
362
  */
363
363
  async resolve(id, identity) {
364
- core.Urn.guard(this.CLASS_NAME, "id", id);
364
+ core.Urn.guard(NftService.CLASS_NAME, "id", id);
365
365
  try {
366
366
  const nftConnector = this.getConnector(id);
367
367
  return nftConnector.resolve(id);
368
368
  }
369
369
  catch (error) {
370
- throw new core.GeneralError(this.CLASS_NAME, "resolveFailed", undefined, error);
370
+ throw new core.GeneralError(NftService.CLASS_NAME, "resolveFailed", undefined, error);
371
371
  }
372
372
  }
373
373
  /**
@@ -377,14 +377,14 @@ class NftService {
377
377
  * @returns Nothing.
378
378
  */
379
379
  async burn(id, identity) {
380
- core.Urn.guard(this.CLASS_NAME, "id", id);
381
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
380
+ core.Urn.guard(NftService.CLASS_NAME, "id", id);
381
+ core.Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
382
382
  try {
383
383
  const nftConnector = this.getConnector(id);
384
384
  await nftConnector.burn(identity, id);
385
385
  }
386
386
  catch (error) {
387
- throw new core.GeneralError(this.CLASS_NAME, "burnFailed", undefined, error);
387
+ throw new core.GeneralError(NftService.CLASS_NAME, "burnFailed", undefined, error);
388
388
  }
389
389
  }
390
390
  /**
@@ -397,16 +397,16 @@ class NftService {
397
397
  * @returns Nothing.
398
398
  */
399
399
  async transfer(id, recipientIdentity, recipientAddress, metadata, identity) {
400
- core.Urn.guard(this.CLASS_NAME, "id", id);
401
- core.Guards.stringValue(this.CLASS_NAME, "recipientIdentity", recipientIdentity);
402
- core.Guards.stringValue(this.CLASS_NAME, "recipientAddress", recipientAddress);
403
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
400
+ core.Urn.guard(NftService.CLASS_NAME, "id", id);
401
+ core.Guards.stringValue(NftService.CLASS_NAME, "recipientIdentity", recipientIdentity);
402
+ core.Guards.stringValue(NftService.CLASS_NAME, "recipientAddress", recipientAddress);
403
+ core.Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
404
404
  try {
405
405
  const nftConnector = this.getConnector(id);
406
406
  await nftConnector.transfer(identity, id, recipientIdentity, recipientAddress, metadata);
407
407
  }
408
408
  catch (error) {
409
- throw new core.GeneralError(this.CLASS_NAME, "transferFailed", undefined, error);
409
+ throw new core.GeneralError(NftService.CLASS_NAME, "transferFailed", undefined, error);
410
410
  }
411
411
  }
412
412
  /**
@@ -417,15 +417,15 @@ class NftService {
417
417
  * @returns Nothing.
418
418
  */
419
419
  async update(id, metadata, identity) {
420
- core.Urn.guard(this.CLASS_NAME, "id", id);
421
- core.Guards.object(this.CLASS_NAME, "metadata", metadata);
422
- core.Guards.stringValue(this.CLASS_NAME, "identity", identity);
420
+ core.Urn.guard(NftService.CLASS_NAME, "id", id);
421
+ core.Guards.object(NftService.CLASS_NAME, "metadata", metadata);
422
+ core.Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
423
423
  try {
424
424
  const nftConnector = this.getConnector(id);
425
425
  await nftConnector.update(identity, id, metadata);
426
426
  }
427
427
  catch (error) {
428
- throw new core.GeneralError(this.CLASS_NAME, "updateFailed", undefined, error);
428
+ throw new core.GeneralError(NftService.CLASS_NAME, "updateFailed", undefined, error);
429
429
  }
430
430
  }
431
431
  /**
@@ -437,7 +437,7 @@ class NftService {
437
437
  getConnector(id) {
438
438
  const idUri = core.Urn.fromValidString(id);
439
439
  if (idUri.namespaceIdentifier() !== NftService._NAMESPACE) {
440
- throw new core.GeneralError(this.CLASS_NAME, "namespaceMismatch", {
440
+ throw new core.GeneralError(NftService.CLASS_NAME, "namespaceMismatch", {
441
441
  namespace: NftService._NAMESPACE,
442
442
  id
443
443
  });
@@ -305,15 +305,15 @@ async function nftUpdate(httpRequestContext, componentName, request) {
305
305
  * Service for performing NFT operations to a connector.
306
306
  */
307
307
  class NftService {
308
+ /**
309
+ * Runtime name for the class.
310
+ */
311
+ static CLASS_NAME = "NftService";
308
312
  /**
309
313
  * The namespace supported by the nft service.
310
314
  * @internal
311
315
  */
312
316
  static _NAMESPACE = "nft";
313
- /**
314
- * Runtime name for the class.
315
- */
316
- CLASS_NAME = "NftService";
317
317
  /**
318
318
  * The default namespace for the connector to use.
319
319
  * @internal
@@ -326,7 +326,7 @@ class NftService {
326
326
  constructor(options) {
327
327
  const names = NftConnectorFactory.names();
328
328
  if (names.length === 0) {
329
- throw new GeneralError(this.CLASS_NAME, "noConnectors");
329
+ throw new GeneralError(NftService.CLASS_NAME, "noConnectors");
330
330
  }
331
331
  this._defaultNamespace = options?.config?.defaultNamespace ?? names[0];
332
332
  }
@@ -340,8 +340,8 @@ class NftService {
340
340
  * @returns The id of the created NFT in urn format.
341
341
  */
342
342
  async mint(tag, immutableMetadata, metadata, namespace, identity) {
343
- Guards.stringValue(this.CLASS_NAME, "tag", tag);
344
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
343
+ Guards.stringValue(NftService.CLASS_NAME, "tag", tag);
344
+ Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
345
345
  try {
346
346
  const connectorNamespace = namespace ?? this._defaultNamespace;
347
347
  const nftConnector = NftConnectorFactory.get(connectorNamespace);
@@ -349,7 +349,7 @@ class NftService {
349
349
  return nftUrn;
350
350
  }
351
351
  catch (error) {
352
- throw new GeneralError(this.CLASS_NAME, "mintFailed", undefined, error);
352
+ throw new GeneralError(NftService.CLASS_NAME, "mintFailed", undefined, error);
353
353
  }
354
354
  }
355
355
  /**
@@ -359,13 +359,13 @@ class NftService {
359
359
  * @returns The data for the NFT.
360
360
  */
361
361
  async resolve(id, identity) {
362
- Urn.guard(this.CLASS_NAME, "id", id);
362
+ Urn.guard(NftService.CLASS_NAME, "id", id);
363
363
  try {
364
364
  const nftConnector = this.getConnector(id);
365
365
  return nftConnector.resolve(id);
366
366
  }
367
367
  catch (error) {
368
- throw new GeneralError(this.CLASS_NAME, "resolveFailed", undefined, error);
368
+ throw new GeneralError(NftService.CLASS_NAME, "resolveFailed", undefined, error);
369
369
  }
370
370
  }
371
371
  /**
@@ -375,14 +375,14 @@ class NftService {
375
375
  * @returns Nothing.
376
376
  */
377
377
  async burn(id, identity) {
378
- Urn.guard(this.CLASS_NAME, "id", id);
379
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
378
+ Urn.guard(NftService.CLASS_NAME, "id", id);
379
+ Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
380
380
  try {
381
381
  const nftConnector = this.getConnector(id);
382
382
  await nftConnector.burn(identity, id);
383
383
  }
384
384
  catch (error) {
385
- throw new GeneralError(this.CLASS_NAME, "burnFailed", undefined, error);
385
+ throw new GeneralError(NftService.CLASS_NAME, "burnFailed", undefined, error);
386
386
  }
387
387
  }
388
388
  /**
@@ -395,16 +395,16 @@ class NftService {
395
395
  * @returns Nothing.
396
396
  */
397
397
  async transfer(id, recipientIdentity, recipientAddress, metadata, identity) {
398
- Urn.guard(this.CLASS_NAME, "id", id);
399
- Guards.stringValue(this.CLASS_NAME, "recipientIdentity", recipientIdentity);
400
- Guards.stringValue(this.CLASS_NAME, "recipientAddress", recipientAddress);
401
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
398
+ Urn.guard(NftService.CLASS_NAME, "id", id);
399
+ Guards.stringValue(NftService.CLASS_NAME, "recipientIdentity", recipientIdentity);
400
+ Guards.stringValue(NftService.CLASS_NAME, "recipientAddress", recipientAddress);
401
+ Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
402
402
  try {
403
403
  const nftConnector = this.getConnector(id);
404
404
  await nftConnector.transfer(identity, id, recipientIdentity, recipientAddress, metadata);
405
405
  }
406
406
  catch (error) {
407
- throw new GeneralError(this.CLASS_NAME, "transferFailed", undefined, error);
407
+ throw new GeneralError(NftService.CLASS_NAME, "transferFailed", undefined, error);
408
408
  }
409
409
  }
410
410
  /**
@@ -415,15 +415,15 @@ class NftService {
415
415
  * @returns Nothing.
416
416
  */
417
417
  async update(id, metadata, identity) {
418
- Urn.guard(this.CLASS_NAME, "id", id);
419
- Guards.object(this.CLASS_NAME, "metadata", metadata);
420
- Guards.stringValue(this.CLASS_NAME, "identity", identity);
418
+ Urn.guard(NftService.CLASS_NAME, "id", id);
419
+ Guards.object(NftService.CLASS_NAME, "metadata", metadata);
420
+ Guards.stringValue(NftService.CLASS_NAME, "identity", identity);
421
421
  try {
422
422
  const nftConnector = this.getConnector(id);
423
423
  await nftConnector.update(identity, id, metadata);
424
424
  }
425
425
  catch (error) {
426
- throw new GeneralError(this.CLASS_NAME, "updateFailed", undefined, error);
426
+ throw new GeneralError(NftService.CLASS_NAME, "updateFailed", undefined, error);
427
427
  }
428
428
  }
429
429
  /**
@@ -435,7 +435,7 @@ class NftService {
435
435
  getConnector(id) {
436
436
  const idUri = Urn.fromValidString(id);
437
437
  if (idUri.namespaceIdentifier() !== NftService._NAMESPACE) {
438
- throw new GeneralError(this.CLASS_NAME, "namespaceMismatch", {
438
+ throw new GeneralError(NftService.CLASS_NAME, "namespaceMismatch", {
439
439
  namespace: NftService._NAMESPACE,
440
440
  id
441
441
  });
@@ -7,7 +7,7 @@ export declare class NftService implements INftComponent {
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of NftService.
13
13
  * @param options The options for the service.
package/docs/changelog.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @twin.org/nft-service - Changelog
2
2
 
3
+ ## [0.0.2-next.8](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.7...nft-service-v0.0.2-next.8) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([0055a56](https://github.com/twinfoundation/nft/commit/0055a56ed166946f1db860aa0725ad53248b3427))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/nft-models bumped from 0.0.2-next.7 to 0.0.2-next.8
16
+ * devDependencies
17
+ * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.7 to 0.0.2-next.8
18
+
19
+ ## [0.0.2-next.7](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.6...nft-service-v0.0.2-next.7) (2025-09-26)
20
+
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * **nft-service:** Synchronize repo versions
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @twin.org/nft-models bumped from 0.0.2-next.6 to 0.0.2-next.7
32
+ * devDependencies
33
+ * @twin.org/nft-connector-entity-storage bumped from 0.0.2-next.6 to 0.0.2-next.7
34
+
3
35
  ## [0.0.2-next.6](https://github.com/twinfoundation/nft/compare/nft-service-v0.0.2-next.5...nft-service-v0.0.2-next.6) (2025-09-25)
4
36
 
5
37
 
@@ -82,7 +82,7 @@
82
82
  "exampleResponse": {
83
83
  "value": {
84
84
  "name": "GeneralError",
85
- "message": "component.error",
85
+ "message": "errorMessage",
86
86
  "properties": {
87
87
  "foo": "bar"
88
88
  }
@@ -103,7 +103,7 @@
103
103
  "exampleResponse": {
104
104
  "value": {
105
105
  "name": "UnauthorizedError",
106
- "message": "component.error"
106
+ "message": "errorMessage"
107
107
  }
108
108
  }
109
109
  }
@@ -121,7 +121,7 @@
121
121
  "exampleResponse": {
122
122
  "value": {
123
123
  "name": "InternalServerError",
124
- "message": "component.error"
124
+ "message": "errorMessage"
125
125
  }
126
126
  }
127
127
  }
@@ -195,7 +195,7 @@
195
195
  "exampleResponse": {
196
196
  "value": {
197
197
  "name": "GeneralError",
198
- "message": "component.error",
198
+ "message": "errorMessage",
199
199
  "properties": {
200
200
  "foo": "bar"
201
201
  }
@@ -216,7 +216,7 @@
216
216
  "exampleResponse": {
217
217
  "value": {
218
218
  "name": "UnauthorizedError",
219
- "message": "component.error"
219
+ "message": "errorMessage"
220
220
  }
221
221
  }
222
222
  }
@@ -234,7 +234,7 @@
234
234
  "exampleResponse": {
235
235
  "value": {
236
236
  "name": "InternalServerError",
237
- "message": "component.error"
237
+ "message": "errorMessage"
238
238
  }
239
239
  }
240
240
  }
@@ -282,7 +282,7 @@
282
282
  "exampleResponse": {
283
283
  "value": {
284
284
  "name": "GeneralError",
285
- "message": "component.error",
285
+ "message": "errorMessage",
286
286
  "properties": {
287
287
  "foo": "bar"
288
288
  }
@@ -303,7 +303,7 @@
303
303
  "exampleResponse": {
304
304
  "value": {
305
305
  "name": "UnauthorizedError",
306
- "message": "component.error"
306
+ "message": "errorMessage"
307
307
  }
308
308
  }
309
309
  }
@@ -321,7 +321,7 @@
321
321
  "exampleResponse": {
322
322
  "value": {
323
323
  "name": "InternalServerError",
324
- "message": "component.error"
324
+ "message": "errorMessage"
325
325
  }
326
326
  }
327
327
  }
@@ -389,7 +389,7 @@
389
389
  "exampleResponse": {
390
390
  "value": {
391
391
  "name": "GeneralError",
392
- "message": "component.error",
392
+ "message": "errorMessage",
393
393
  "properties": {
394
394
  "foo": "bar"
395
395
  }
@@ -410,7 +410,7 @@
410
410
  "exampleResponse": {
411
411
  "value": {
412
412
  "name": "UnauthorizedError",
413
- "message": "component.error"
413
+ "message": "errorMessage"
414
414
  }
415
415
  }
416
416
  }
@@ -428,7 +428,7 @@
428
428
  "exampleResponse": {
429
429
  "value": {
430
430
  "name": "InternalServerError",
431
- "message": "component.error"
431
+ "message": "errorMessage"
432
432
  }
433
433
  }
434
434
  }
@@ -500,7 +500,7 @@
500
500
  "exampleResponse": {
501
501
  "value": {
502
502
  "name": "GeneralError",
503
- "message": "component.error",
503
+ "message": "errorMessage",
504
504
  "properties": {
505
505
  "foo": "bar"
506
506
  }
@@ -521,7 +521,7 @@
521
521
  "exampleResponse": {
522
522
  "value": {
523
523
  "name": "UnauthorizedError",
524
- "message": "component.error"
524
+ "message": "errorMessage"
525
525
  }
526
526
  }
527
527
  }
@@ -539,7 +539,7 @@
539
539
  "exampleResponse": {
540
540
  "value": {
541
541
  "name": "InternalServerError",
542
- "message": "component.error"
542
+ "message": "errorMessage"
543
543
  }
544
544
  }
545
545
  }
@@ -30,14 +30,10 @@ The options for the service.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
- #### Implementation of
38
-
39
- `INftComponent.CLASS_NAME`
40
-
41
37
  ## Methods
42
38
 
43
39
  ### mint()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/nft-service",
3
- "version": "0.0.2-next.6",
3
+ "version": "0.0.2-next.8",
4
4
  "description": "NFT contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/entity": "next",
20
20
  "@twin.org/nameof": "next",
21
- "@twin.org/nft-models": "0.0.2-next.6",
21
+ "@twin.org/nft-models": "0.0.2-next.8",
22
22
  "@twin.org/web": "next"
23
23
  },
24
24
  "main": "./dist/cjs/index.cjs",
@@ -38,5 +38,23 @@
38
38
  "dist/types",
39
39
  "locales",
40
40
  "docs"
41
- ]
41
+ ],
42
+ "keywords": [
43
+ "twin",
44
+ "trade",
45
+ "iota",
46
+ "framework",
47
+ "blockchain",
48
+ "nft",
49
+ "tokens",
50
+ "non-fungible",
51
+ "assets",
52
+ "service",
53
+ "microservice",
54
+ "business-logic"
55
+ ],
56
+ "bugs": {
57
+ "url": "git+https://github.com/twinfoundation/nft/issues"
58
+ },
59
+ "homepage": "https://twindev.org"
42
60
  }