@nextera.one/axis-server-sdk 2.1.0 → 2.1.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/dist/index.js CHANGED
@@ -635,6 +635,7 @@ var constants_exports = {};
635
635
  __export(constants_exports, {
636
636
  AXIS_MAGIC: () => import_axis_protocol2.AXIS_MAGIC,
637
637
  AXIS_VERSION: () => import_axis_protocol2.AXIS_VERSION,
638
+ AxisMediaTypes: () => AxisMediaTypes,
638
639
  BodyProfile: () => import_axis_protocol2.BodyProfile,
639
640
  ERR_BAD_SIGNATURE: () => import_axis_protocol2.ERR_BAD_SIGNATURE,
640
641
  ERR_CONTRACT_VIOLATION: () => import_axis_protocol2.ERR_CONTRACT_VIOLATION,
@@ -696,10 +697,31 @@ __export(constants_exports, {
696
697
  TLV_TS: () => import_axis_protocol2.TLV_TS,
697
698
  TLV_UPLOAD_ID: () => import_axis_protocol2.TLV_UPLOAD_ID
698
699
  });
699
- var import_axis_protocol2;
700
+ var import_axis_protocol2, _AxisMediaTypes, AxisMediaTypes;
700
701
  var init_constants = __esm({
701
702
  "src/core/constants.ts"() {
702
703
  import_axis_protocol2 = require("@nextera.one/axis-protocol");
704
+ _AxisMediaTypes = class _AxisMediaTypes {
705
+ static normalize(value) {
706
+ if (!value) return void 0;
707
+ return value.split(";", 1)[0].trim().toLowerCase();
708
+ }
709
+ static isAxisContentType(value) {
710
+ const normalized = _AxisMediaTypes.normalize(value);
711
+ return !!normalized && _AxisMediaTypes.VALID_AXIS_CONTENT_TYPES.some(
712
+ (contentType) => contentType === normalized
713
+ );
714
+ }
715
+ };
716
+ _AxisMediaTypes.BINARY = "application/axis-bin";
717
+ _AxisMediaTypes.OCTET_STREAM = "application/octet-stream";
718
+ _AxisMediaTypes.LEGACY_BINARY = "application/x-axis";
719
+ _AxisMediaTypes.VALID_AXIS_CONTENT_TYPES = [
720
+ _AxisMediaTypes.BINARY,
721
+ _AxisMediaTypes.OCTET_STREAM,
722
+ _AxisMediaTypes.LEGACY_BINARY
723
+ ];
724
+ AxisMediaTypes = _AxisMediaTypes;
703
725
  }
704
726
  });
705
727
 
@@ -1884,49 +1906,12 @@ var init_inline_capsule = __esm({
1884
1906
  var require_intent_router = __commonJS({
1885
1907
  "src/engine/intent.router.ts"(exports2) {
1886
1908
  "use strict";
1887
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
1888
- if (k2 === void 0) k2 = k;
1889
- var desc = Object.getOwnPropertyDescriptor(m, k);
1890
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1891
- desc = { enumerable: true, get: function() {
1892
- return m[k];
1893
- } };
1894
- }
1895
- Object.defineProperty(o, k2, desc);
1896
- }) : (function(o, m, k, k2) {
1897
- if (k2 === void 0) k2 = k;
1898
- o[k2] = m[k];
1899
- }));
1900
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
1901
- Object.defineProperty(o, "default", { enumerable: true, value: v });
1902
- }) : function(o, v) {
1903
- o["default"] = v;
1904
- });
1905
1909
  var __decorate = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
1906
1910
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1907
1911
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1908
1912
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1909
1913
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1910
1914
  };
1911
- var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
1912
- var ownKeys = function(o) {
1913
- ownKeys = Object.getOwnPropertyNames || function(o2) {
1914
- var ar = [];
1915
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
1916
- return ar;
1917
- };
1918
- return ownKeys(o);
1919
- };
1920
- return function(mod) {
1921
- if (mod && mod.__esModule) return mod;
1922
- var result = {};
1923
- if (mod != null) {
1924
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
1925
- }
1926
- __setModuleDefault(result, mod);
1927
- return result;
1928
- };
1929
- })();
1930
1915
  var __metadata = exports2 && exports2.__metadata || function(k, v) {
1931
1916
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1932
1917
  };
@@ -2393,7 +2378,7 @@ var require_intent_router = __commonJS({
2393
2378
  }
2394
2379
  }
2395
2380
  async executeChainRequest(frame, request) {
2396
- const { AxisChainExecutor: AxisChainExecutor2 } = await Promise.resolve().then(() => __importStar(require_axis_chain_executor()));
2381
+ const { AxisChainExecutor: AxisChainExecutor2 } = await Promise.resolve().then(() => require_axis_chain_executor());
2397
2382
  const headerActorId = this.getActorIdFromFrame(frame);
2398
2383
  if (request.actorId && headerActorId && !this.identifiersMatch(request.actorId, headerActorId)) {
2399
2384
  throw new axis_error_1.AxisError("ACTOR_MISMATCH", "CHAIN.EXEC actorId conflicts with authenticated frame identity", 403);
@@ -5112,49 +5097,12 @@ var init_upload_types = __esm({
5112
5097
  var require_axis_files_handlers = __commonJS({
5113
5098
  "src/upload/axis-files.handlers.ts"(exports2) {
5114
5099
  "use strict";
5115
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
5116
- if (k2 === void 0) k2 = k;
5117
- var desc = Object.getOwnPropertyDescriptor(m, k);
5118
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5119
- desc = { enumerable: true, get: function() {
5120
- return m[k];
5121
- } };
5122
- }
5123
- Object.defineProperty(o, k2, desc);
5124
- }) : (function(o, m, k, k2) {
5125
- if (k2 === void 0) k2 = k;
5126
- o[k2] = m[k];
5127
- }));
5128
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
5129
- Object.defineProperty(o, "default", { enumerable: true, value: v });
5130
- }) : function(o, v) {
5131
- o["default"] = v;
5132
- });
5133
5100
  var __decorate = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
5134
5101
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5135
5102
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5136
5103
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5137
5104
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5138
5105
  };
5139
- var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
5140
- var ownKeys = function(o) {
5141
- ownKeys = Object.getOwnPropertyNames || function(o2) {
5142
- var ar = [];
5143
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
5144
- return ar;
5145
- };
5146
- return ownKeys(o);
5147
- };
5148
- return function(mod) {
5149
- if (mod && mod.__esModule) return mod;
5150
- var result = {};
5151
- if (mod != null) {
5152
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
5153
- }
5154
- __setModuleDefault(result, mod);
5155
- return result;
5156
- };
5157
- })();
5158
5106
  var __metadata = exports2 && exports2.__metadata || function(k, v) {
5159
5107
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5160
5108
  };
@@ -5179,7 +5127,7 @@ var require_axis_files_handlers = __commonJS({
5179
5127
  Object.defineProperty(exports2, "__esModule", { value: true });
5180
5128
  exports2.AxisFilesFinalizeHandler = exports2.AxisFilesDownloadHandler = void 0;
5181
5129
  var common_1 = require("@nestjs/common");
5182
- var crypto3 = __importStar(require("crypto"));
5130
+ var crypto3 = require("crypto");
5183
5131
  var axis_bin_1 = (init_axis_bin(), __toCommonJS(axis_bin_exports));
5184
5132
  var varint_1 = (init_varint(), __toCommonJS(varint_exports));
5185
5133
  var handler_decorator_1 = (init_handler_decorator(), __toCommonJS(handler_decorator_exports));
@@ -6840,6 +6788,7 @@ __export(core_exports, {
6840
6788
  AXIS_VERSION: () => import_axis_protocol2.AXIS_VERSION,
6841
6789
  AxisError: () => AxisError,
6842
6790
  AxisFrameZ: () => AxisFrameZ,
6791
+ AxisMediaTypes: () => AxisMediaTypes,
6843
6792
  BodyProfile: () => import_axis_protocol2.BodyProfile,
6844
6793
  ERR_BAD_SIGNATURE: () => import_axis_protocol2.ERR_BAD_SIGNATURE,
6845
6794
  ERR_CONTRACT_VIOLATION: () => import_axis_protocol2.ERR_CONTRACT_VIOLATION,
@@ -6940,55 +6889,18 @@ var init_types = __esm({
6940
6889
  var require_proof_verification_service = __commonJS({
6941
6890
  "src/crypto/proof-verification.service.ts"(exports2) {
6942
6891
  "use strict";
6943
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
6944
- if (k2 === void 0) k2 = k;
6945
- var desc = Object.getOwnPropertyDescriptor(m, k);
6946
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6947
- desc = { enumerable: true, get: function() {
6948
- return m[k];
6949
- } };
6950
- }
6951
- Object.defineProperty(o, k2, desc);
6952
- }) : (function(o, m, k, k2) {
6953
- if (k2 === void 0) k2 = k;
6954
- o[k2] = m[k];
6955
- }));
6956
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
6957
- Object.defineProperty(o, "default", { enumerable: true, value: v });
6958
- }) : function(o, v) {
6959
- o["default"] = v;
6960
- });
6961
6892
  var __decorate = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
6962
6893
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6963
6894
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6964
6895
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6965
6896
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6966
6897
  };
6967
- var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
6968
- var ownKeys = function(o) {
6969
- ownKeys = Object.getOwnPropertyNames || function(o2) {
6970
- var ar = [];
6971
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
6972
- return ar;
6973
- };
6974
- return ownKeys(o);
6975
- };
6976
- return function(mod) {
6977
- if (mod && mod.__esModule) return mod;
6978
- var result = {};
6979
- if (mod != null) {
6980
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
6981
- }
6982
- __setModuleDefault(result, mod);
6983
- return result;
6984
- };
6985
- })();
6986
6898
  var ProofVerificationService_1;
6987
6899
  Object.defineProperty(exports2, "__esModule", { value: true });
6988
6900
  exports2.ProofVerificationService = void 0;
6989
6901
  var common_1 = require("@nestjs/common");
6990
- var crypto3 = __importStar(require("crypto"));
6991
- var nacl = __importStar(require("tweetnacl"));
6902
+ var crypto3 = require("crypto");
6903
+ var nacl = require("tweetnacl");
6992
6904
  var ProofVerificationService = ProofVerificationService_1 = class ProofVerificationService {
6993
6905
  constructor() {
6994
6906
  this.logger = new common_1.Logger(ProofVerificationService_1.name);
@@ -8098,54 +8010,17 @@ var require_chunk_hash_sensor = __commonJS({
8098
8010
  var require_entropy_sensor = __commonJS({
8099
8011
  "src/sensors/entropy.sensor.ts"(exports2) {
8100
8012
  "use strict";
8101
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
8102
- if (k2 === void 0) k2 = k;
8103
- var desc = Object.getOwnPropertyDescriptor(m, k);
8104
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8105
- desc = { enumerable: true, get: function() {
8106
- return m[k];
8107
- } };
8108
- }
8109
- Object.defineProperty(o, k2, desc);
8110
- }) : (function(o, m, k, k2) {
8111
- if (k2 === void 0) k2 = k;
8112
- o[k2] = m[k];
8113
- }));
8114
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
8115
- Object.defineProperty(o, "default", { enumerable: true, value: v });
8116
- }) : function(o, v) {
8117
- o["default"] = v;
8118
- });
8119
8013
  var __decorate = exports2 && exports2.__decorate || function(decorators, target, key, desc) {
8120
8014
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8121
8015
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8122
8016
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8123
8017
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8124
8018
  };
8125
- var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
8126
- var ownKeys = function(o) {
8127
- ownKeys = Object.getOwnPropertyNames || function(o2) {
8128
- var ar = [];
8129
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
8130
- return ar;
8131
- };
8132
- return ownKeys(o);
8133
- };
8134
- return function(mod) {
8135
- if (mod && mod.__esModule) return mod;
8136
- var result = {};
8137
- if (mod != null) {
8138
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
8139
- }
8140
- __setModuleDefault(result, mod);
8141
- return result;
8142
- };
8143
- })();
8144
8019
  var EntropySensor_1;
8145
8020
  Object.defineProperty(exports2, "__esModule", { value: true });
8146
8021
  exports2.EntropySensor = void 0;
8147
8022
  var common_1 = require("@nestjs/common");
8148
- var crypto3 = __importStar(require("crypto"));
8023
+ var crypto3 = require("crypto");
8149
8024
  var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
8150
8025
  var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
8151
8026
  var constants_1 = (init_constants(), __toCommonJS(constants_exports));
@@ -8805,12 +8680,7 @@ var require_protocol_strict_sensor = __commonJS({
8805
8680
  return true;
8806
8681
  }
8807
8682
  isValidContentType(contentType) {
8808
- const valid = [
8809
- "application/axis-bin",
8810
- "application/octet-stream",
8811
- "application/x-axis"
8812
- ];
8813
- return valid.some((v) => contentType.toLowerCase().includes(v));
8683
+ return constants_1.AxisMediaTypes.isAxisContentType(contentType);
8814
8684
  }
8815
8685
  isValidFlags(flags) {
8816
8686
  return VALID_FLAGS.includes(flags);
@@ -9352,6 +9222,7 @@ __export(index_exports, {
9352
9222
  AxisFrameZ: () => AxisFrameZ,
9353
9223
  AxisIdDto: () => import_axis_id.AxisIdDto,
9354
9224
  AxisIp: () => import_axis_request.AxisIp,
9225
+ AxisMediaTypes: () => AxisMediaTypes,
9355
9226
  AxisPacketTags: () => T,
9356
9227
  AxisPartialType: () => AxisPartialType,
9357
9228
  AxisRaw: () => import_axis_request.AxisRaw,
@@ -9684,6 +9555,7 @@ init_index();
9684
9555
  AxisFrameZ,
9685
9556
  AxisIdDto,
9686
9557
  AxisIp,
9558
+ AxisMediaTypes,
9687
9559
  AxisPacketTags,
9688
9560
  AxisPartialType,
9689
9561
  AxisRaw,