@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.mjs CHANGED
@@ -646,6 +646,7 @@ var constants_exports = {};
646
646
  __export(constants_exports, {
647
647
  AXIS_MAGIC: () => AXIS_MAGIC,
648
648
  AXIS_VERSION: () => AXIS_VERSION,
649
+ AxisMediaTypes: () => AxisMediaTypes,
649
650
  BodyProfile: () => BodyProfile,
650
651
  ERR_BAD_SIGNATURE: () => ERR_BAD_SIGNATURE,
651
652
  ERR_CONTRACT_VIOLATION: () => ERR_CONTRACT_VIOLATION,
@@ -771,8 +772,30 @@ import {
771
772
  ERR_REPLAY_DETECTED,
772
773
  ERR_CONTRACT_VIOLATION
773
774
  } from "@nextera.one/axis-protocol";
775
+ var _AxisMediaTypes, AxisMediaTypes;
774
776
  var init_constants = __esm({
775
777
  "src/core/constants.ts"() {
778
+ _AxisMediaTypes = class _AxisMediaTypes {
779
+ static normalize(value) {
780
+ if (!value) return void 0;
781
+ return value.split(";", 1)[0].trim().toLowerCase();
782
+ }
783
+ static isAxisContentType(value) {
784
+ const normalized = _AxisMediaTypes.normalize(value);
785
+ return !!normalized && _AxisMediaTypes.VALID_AXIS_CONTENT_TYPES.some(
786
+ (contentType) => contentType === normalized
787
+ );
788
+ }
789
+ };
790
+ _AxisMediaTypes.BINARY = "application/axis-bin";
791
+ _AxisMediaTypes.OCTET_STREAM = "application/octet-stream";
792
+ _AxisMediaTypes.LEGACY_BINARY = "application/x-axis";
793
+ _AxisMediaTypes.VALID_AXIS_CONTENT_TYPES = [
794
+ _AxisMediaTypes.BINARY,
795
+ _AxisMediaTypes.OCTET_STREAM,
796
+ _AxisMediaTypes.LEGACY_BINARY
797
+ ];
798
+ AxisMediaTypes = _AxisMediaTypes;
776
799
  }
777
800
  });
778
801
 
@@ -1955,49 +1978,12 @@ var init_inline_capsule = __esm({
1955
1978
  var require_intent_router = __commonJS({
1956
1979
  "src/engine/intent.router.ts"(exports) {
1957
1980
  "use strict";
1958
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
1959
- if (k2 === void 0) k2 = k;
1960
- var desc = Object.getOwnPropertyDescriptor(m, k);
1961
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1962
- desc = { enumerable: true, get: function() {
1963
- return m[k];
1964
- } };
1965
- }
1966
- Object.defineProperty(o, k2, desc);
1967
- }) : (function(o, m, k, k2) {
1968
- if (k2 === void 0) k2 = k;
1969
- o[k2] = m[k];
1970
- }));
1971
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
1972
- Object.defineProperty(o, "default", { enumerable: true, value: v });
1973
- }) : function(o, v) {
1974
- o["default"] = v;
1975
- });
1976
1981
  var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
1977
1982
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1978
1983
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1979
1984
  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;
1980
1985
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1981
1986
  };
1982
- var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
1983
- var ownKeys = function(o) {
1984
- ownKeys = Object.getOwnPropertyNames || function(o2) {
1985
- var ar = [];
1986
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
1987
- return ar;
1988
- };
1989
- return ownKeys(o);
1990
- };
1991
- return function(mod) {
1992
- if (mod && mod.__esModule) return mod;
1993
- var result = {};
1994
- if (mod != null) {
1995
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
1996
- }
1997
- __setModuleDefault(result, mod);
1998
- return result;
1999
- };
2000
- })();
2001
1987
  var __metadata = exports && exports.__metadata || function(k, v) {
2002
1988
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2003
1989
  };
@@ -2464,7 +2450,7 @@ var require_intent_router = __commonJS({
2464
2450
  }
2465
2451
  }
2466
2452
  async executeChainRequest(frame, request) {
2467
- const { AxisChainExecutor: AxisChainExecutor2 } = await Promise.resolve().then(() => __importStar(require_axis_chain_executor()));
2453
+ const { AxisChainExecutor: AxisChainExecutor2 } = await Promise.resolve().then(() => require_axis_chain_executor());
2468
2454
  const headerActorId = this.getActorIdFromFrame(frame);
2469
2455
  if (request.actorId && headerActorId && !this.identifiersMatch(request.actorId, headerActorId)) {
2470
2456
  throw new axis_error_1.AxisError("ACTOR_MISMATCH", "CHAIN.EXEC actorId conflicts with authenticated frame identity", 403);
@@ -5178,49 +5164,12 @@ var init_upload_types = __esm({
5178
5164
  var require_axis_files_handlers = __commonJS({
5179
5165
  "src/upload/axis-files.handlers.ts"(exports) {
5180
5166
  "use strict";
5181
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
5182
- if (k2 === void 0) k2 = k;
5183
- var desc = Object.getOwnPropertyDescriptor(m, k);
5184
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5185
- desc = { enumerable: true, get: function() {
5186
- return m[k];
5187
- } };
5188
- }
5189
- Object.defineProperty(o, k2, desc);
5190
- }) : (function(o, m, k, k2) {
5191
- if (k2 === void 0) k2 = k;
5192
- o[k2] = m[k];
5193
- }));
5194
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
5195
- Object.defineProperty(o, "default", { enumerable: true, value: v });
5196
- }) : function(o, v) {
5197
- o["default"] = v;
5198
- });
5199
5167
  var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
5200
5168
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5201
5169
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5202
5170
  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;
5203
5171
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5204
5172
  };
5205
- var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
5206
- var ownKeys = function(o) {
5207
- ownKeys = Object.getOwnPropertyNames || function(o2) {
5208
- var ar = [];
5209
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
5210
- return ar;
5211
- };
5212
- return ownKeys(o);
5213
- };
5214
- return function(mod) {
5215
- if (mod && mod.__esModule) return mod;
5216
- var result = {};
5217
- if (mod != null) {
5218
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
5219
- }
5220
- __setModuleDefault(result, mod);
5221
- return result;
5222
- };
5223
- })();
5224
5173
  var __metadata = exports && exports.__metadata || function(k, v) {
5225
5174
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5226
5175
  };
@@ -5245,7 +5194,7 @@ var require_axis_files_handlers = __commonJS({
5245
5194
  Object.defineProperty(exports, "__esModule", { value: true });
5246
5195
  exports.AxisFilesFinalizeHandler = exports.AxisFilesDownloadHandler = void 0;
5247
5196
  var common_1 = __require("@nestjs/common");
5248
- var crypto3 = __importStar(__require("crypto"));
5197
+ var crypto3 = __require("crypto");
5249
5198
  var axis_bin_1 = (init_axis_bin(), __toCommonJS(axis_bin_exports));
5250
5199
  var varint_1 = (init_varint(), __toCommonJS(varint_exports));
5251
5200
  var handler_decorator_1 = (init_handler_decorator(), __toCommonJS(handler_decorator_exports));
@@ -6905,6 +6854,7 @@ __export(core_exports, {
6905
6854
  AXIS_VERSION: () => AXIS_VERSION,
6906
6855
  AxisError: () => AxisError,
6907
6856
  AxisFrameZ: () => AxisFrameZ,
6857
+ AxisMediaTypes: () => AxisMediaTypes,
6908
6858
  BodyProfile: () => BodyProfile,
6909
6859
  ERR_BAD_SIGNATURE: () => ERR_BAD_SIGNATURE,
6910
6860
  ERR_CONTRACT_VIOLATION: () => ERR_CONTRACT_VIOLATION,
@@ -7005,55 +6955,18 @@ var init_types = __esm({
7005
6955
  var require_proof_verification_service = __commonJS({
7006
6956
  "src/crypto/proof-verification.service.ts"(exports) {
7007
6957
  "use strict";
7008
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
7009
- if (k2 === void 0) k2 = k;
7010
- var desc = Object.getOwnPropertyDescriptor(m, k);
7011
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7012
- desc = { enumerable: true, get: function() {
7013
- return m[k];
7014
- } };
7015
- }
7016
- Object.defineProperty(o, k2, desc);
7017
- }) : (function(o, m, k, k2) {
7018
- if (k2 === void 0) k2 = k;
7019
- o[k2] = m[k];
7020
- }));
7021
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
7022
- Object.defineProperty(o, "default", { enumerable: true, value: v });
7023
- }) : function(o, v) {
7024
- o["default"] = v;
7025
- });
7026
6958
  var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
7027
6959
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7028
6960
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7029
6961
  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;
7030
6962
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7031
6963
  };
7032
- var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
7033
- var ownKeys = function(o) {
7034
- ownKeys = Object.getOwnPropertyNames || function(o2) {
7035
- var ar = [];
7036
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
7037
- return ar;
7038
- };
7039
- return ownKeys(o);
7040
- };
7041
- return function(mod) {
7042
- if (mod && mod.__esModule) return mod;
7043
- var result = {};
7044
- if (mod != null) {
7045
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
7046
- }
7047
- __setModuleDefault(result, mod);
7048
- return result;
7049
- };
7050
- })();
7051
6964
  var ProofVerificationService_1;
7052
6965
  Object.defineProperty(exports, "__esModule", { value: true });
7053
6966
  exports.ProofVerificationService = void 0;
7054
6967
  var common_1 = __require("@nestjs/common");
7055
- var crypto3 = __importStar(__require("crypto"));
7056
- var nacl = __importStar(__require("tweetnacl"));
6968
+ var crypto3 = __require("crypto");
6969
+ var nacl = __require("tweetnacl");
7057
6970
  var ProofVerificationService = ProofVerificationService_1 = class ProofVerificationService {
7058
6971
  constructor() {
7059
6972
  this.logger = new common_1.Logger(ProofVerificationService_1.name);
@@ -8163,54 +8076,17 @@ var require_chunk_hash_sensor = __commonJS({
8163
8076
  var require_entropy_sensor = __commonJS({
8164
8077
  "src/sensors/entropy.sensor.ts"(exports) {
8165
8078
  "use strict";
8166
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
8167
- if (k2 === void 0) k2 = k;
8168
- var desc = Object.getOwnPropertyDescriptor(m, k);
8169
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8170
- desc = { enumerable: true, get: function() {
8171
- return m[k];
8172
- } };
8173
- }
8174
- Object.defineProperty(o, k2, desc);
8175
- }) : (function(o, m, k, k2) {
8176
- if (k2 === void 0) k2 = k;
8177
- o[k2] = m[k];
8178
- }));
8179
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
8180
- Object.defineProperty(o, "default", { enumerable: true, value: v });
8181
- }) : function(o, v) {
8182
- o["default"] = v;
8183
- });
8184
8079
  var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
8185
8080
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8186
8081
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8187
8082
  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;
8188
8083
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8189
8084
  };
8190
- var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
8191
- var ownKeys = function(o) {
8192
- ownKeys = Object.getOwnPropertyNames || function(o2) {
8193
- var ar = [];
8194
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
8195
- return ar;
8196
- };
8197
- return ownKeys(o);
8198
- };
8199
- return function(mod) {
8200
- if (mod && mod.__esModule) return mod;
8201
- var result = {};
8202
- if (mod != null) {
8203
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
8204
- }
8205
- __setModuleDefault(result, mod);
8206
- return result;
8207
- };
8208
- })();
8209
8085
  var EntropySensor_1;
8210
8086
  Object.defineProperty(exports, "__esModule", { value: true });
8211
8087
  exports.EntropySensor = void 0;
8212
8088
  var common_1 = __require("@nestjs/common");
8213
- var crypto3 = __importStar(__require("crypto"));
8089
+ var crypto3 = __require("crypto");
8214
8090
  var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
8215
8091
  var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
8216
8092
  var constants_1 = (init_constants(), __toCommonJS(constants_exports));
@@ -8870,12 +8746,7 @@ var require_protocol_strict_sensor = __commonJS({
8870
8746
  return true;
8871
8747
  }
8872
8748
  isValidContentType(contentType) {
8873
- const valid = [
8874
- "application/axis-bin",
8875
- "application/octet-stream",
8876
- "application/x-axis"
8877
- ];
8878
- return valid.some((v) => contentType.toLowerCase().includes(v));
8749
+ return constants_1.AxisMediaTypes.isAxisContentType(contentType);
8879
8750
  }
8880
8751
  isValidFlags(flags) {
8881
8752
  return VALID_FLAGS.includes(flags);
@@ -9417,6 +9288,7 @@ __export(index_exports, {
9417
9288
  AxisFrameZ: () => AxisFrameZ,
9418
9289
  AxisIdDto: () => import_axis_id.AxisIdDto,
9419
9290
  AxisIp: () => import_axis_request.AxisIp,
9291
+ AxisMediaTypes: () => AxisMediaTypes,
9420
9292
  AxisPacketTags: () => T,
9421
9293
  AxisPartialType: () => AxisPartialType,
9422
9294
  AxisRaw: () => import_axis_request.AxisRaw,
@@ -9772,6 +9644,7 @@ export {
9772
9644
  AxisFrameZ,
9773
9645
  export_AxisIdDto as AxisIdDto,
9774
9646
  export_AxisIp as AxisIp,
9647
+ AxisMediaTypes,
9775
9648
  T as AxisPacketTags,
9776
9649
  AxisPartialType,
9777
9650
  export_AxisRaw as AxisRaw,