@nextera.one/axis-server-sdk 1.2.0 → 1.2.1

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.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ModuleRef } from '@nestjs/core';
1
2
  import { AxisFrame as AxisFrame$1 } from './core/index.mjs';
2
3
  export { AxisBinaryFrame, AxisFrameZ, computeReceiptHash, computeSignaturePayload, decodeFrame, encodeFrame, generateEd25519KeyPair, getSignTarget, sha256, signFrame, verifyFrameSignature } from './core/index.mjs';
3
4
  export { AXIS_MAGIC, AXIS_VERSION, TLV as AxisTlvType, BodyProfile, ERR_BAD_SIGNATURE, ERR_CONTRACT_VIOLATION, ERR_INVALID_PACKET, ERR_REPLAY_DETECTED, FLAG_BODY_TLV, FLAG_CHAIN_REQ, FLAG_HAS_WITNESS, MAX_BODY_LEN, MAX_FRAME_LEN, MAX_HDR_LEN, MAX_SIG_LEN, NCERT_ALG, NCERT_EXP, NCERT_ISSUER_KID, NCERT_KID, NCERT_NBF, NCERT_NODE_ID, NCERT_PAYLOAD, NCERT_PUB, NCERT_SCOPE, NCERT_SIG, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, PROOF_NONE, PROOF_WITNESS, ProofType, TLV, TLV_ACTOR_ID, TLV_AUD, TLV_BODY_ARR, TLV_BODY_OBJ, TLV_CAPSULE, TLV_EFFECT, TLV_ERROR_CODE, TLV_ERROR_MSG, TLV_INDEX, TLV_INTENT, TLV_KID, TLV_LOOM_PRESENCE_ID, TLV_LOOM_THREAD_HASH, TLV_LOOM_WRIT, TLV_NODE, TLV_NODE_CERT_HASH, TLV_NODE_KID, TLV_NONCE, TLV_OFFSET, TLV_OK, TLV_PID, TLV_PREV_HASH, TLV_PROOF_REF, TLV_PROOF_TYPE, TLV_REALM, TLV_RECEIPT_HASH, TLV_RID, TLV_SHA256_CHUNK, TLV_TRACE_ID, TLV_TS, TLV_UPLOAD_ID, decodeArray, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeTLVs, encodeVarint, varintLength } from '@nextera.one/axis-protocol';
@@ -38,6 +39,12 @@ interface IntentOptions {
38
39
  }
39
40
  declare function Intent(action: string, options?: IntentOptions): MethodDecorator;
40
41
 
42
+ declare const INTENT_BODY_KEY = "axis:intent:body";
43
+ declare function IntentBody(decoder: (buf: Buffer) => any): MethodDecorator;
44
+
45
+ declare const INTENT_SENSORS_KEY = "axis:intent:sensors";
46
+ declare function IntentSensors(sensors: Function[]): MethodDecorator;
47
+
41
48
  declare const TLV_FIELDS_KEY = "axis:tlv:fields";
42
49
  declare const TLV_VALIDATORS_KEY = "axis:tlv:validators";
43
50
  type TlvFieldKind = 'utf8' | 'u64' | 'bytes' | 'bytes16' | 'bool' | 'obj' | 'arr';
@@ -95,6 +102,20 @@ declare abstract class AxisResponseDto extends AxisTlvDto {
95
102
  updated_by?: string;
96
103
  }
97
104
 
105
+ interface IntentSchema {
106
+ intent: string;
107
+ version: number;
108
+ bodyProfile: 'TLV_MAP' | 'RAW' | 'TLV_OBJ' | 'TLV_ARR';
109
+ fields: Array<{
110
+ name: string;
111
+ tlv: number;
112
+ kind: IntentTlvField['kind'];
113
+ required?: boolean;
114
+ maxLen?: number;
115
+ max?: string;
116
+ scope?: 'header' | 'body';
117
+ }>;
118
+ }
98
119
  interface AxisEffect {
99
120
  ok: boolean;
100
121
  effect: string;
@@ -103,11 +124,34 @@ interface AxisEffect {
103
124
  metadata?: any;
104
125
  }
105
126
  declare class IntentRouter {
127
+ private readonly moduleRef?;
128
+ private readonly logger;
129
+ private static readonly BUILTIN_INTENTS;
106
130
  private handlers;
131
+ private intentSensors;
132
+ private intentDecoders;
133
+ private intentSchemas;
134
+ private intentValidators;
135
+ private intentKinds;
136
+ constructor(moduleRef?: ModuleRef | undefined);
137
+ getSchema(intent: string): IntentSchema | undefined;
138
+ getValidators(intent: string): Map<number, TlvValidatorFn[]> | undefined;
139
+ has(intent: string): boolean;
140
+ getRegisteredIntents(): string[];
141
+ getIntentEntry(intent: string): {
142
+ schema?: IntentSchema;
143
+ validators?: Map<number, TlvValidatorFn[]>;
144
+ hasSensors: boolean;
145
+ builtin: boolean;
146
+ kind?: IntentKind;
147
+ } | null;
107
148
  register(intent: string, handler: any): void;
108
149
  registerHandler(instance: any): void;
109
150
  route(frame: AxisFrame$1): Promise<AxisEffect>;
110
- private recordLatency;
151
+ private logIntent;
152
+ registerIntentMeta(intent: string, proto: object, methodName: string): void;
153
+ private runIntentSensors;
154
+ private storeSchema;
111
155
  }
112
156
 
113
157
  declare const ATS1_HDR: {
@@ -438,6 +482,10 @@ interface AxisCapsulePayload {
438
482
  constraints?: AxisCapsuleConstraints;
439
483
  meta?: Record<string, unknown>;
440
484
  }
485
+ interface AxisCapsule {
486
+ payload: AxisCapsulePayload;
487
+ sig: AxisSig$1;
488
+ }
441
489
  interface AxisResponse$1<T = any> {
442
490
  ok: boolean;
443
491
  pid: string;
@@ -758,4 +806,85 @@ interface IntentDefinition {
758
806
  declare function validateFrameShape(frame: any): boolean;
759
807
  declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
760
808
 
761
- export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg$1 as AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, AxisIdDto, type AxisAlg as AxisJsonAlg, type AxisFrame as AxisJsonFrame, type AxisResponse as AxisJsonResponse, type AxisSig as AxisJsonSig, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, AxisPartialType, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, AxisResponseDto, type AxisSensor, type AxisSensorInit, type AxisSig$1 as AxisSig, AxisTlvDto, CAPABILITIES, type Capability, type CapsuleMode, ContractViolationError, DEFAULT_CONTRACTS, DEFAULT_TIMEOUT, Decision, type DtoSchema, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_METADATA_KEY, INTENT_REQUIREMENTS, INTENT_ROUTES_KEY, INTENT_SENSITIVITY_MAP, INTENT_TIMEOUTS, Intent, type IntentDefinition, type IntentKind, type IntentOptions, type IntentRoute, IntentRouter, IntentSensitivity, type IntentTlvField, type KeyStatus, PROOF_CAPABILITIES, RESPONSE_TAG_CREATED_AT, RESPONSE_TAG_CREATED_BY, RESPONSE_TAG_ID, RESPONSE_TAG_UPDATED_AT, RESPONSE_TAG_UPDATED_BY, type ReceiptEffect, RiskDecision, type RiskEvaluation, type RiskSignal, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, TLV_FIELDS_KEY, TLV_VALIDATORS_KEY, TlvEnum, TlvField, type TlvFieldKind, type TlvFieldMeta, type TlvFieldOptions, TlvMinLen, TlvRange, TlvUtf8Pattern, TlvValidate, type TlvValidatorFn, type TlvValidatorMeta, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildDtoDecoder, buildPacket, buildReceiptHash, buildTLVs, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, classifyIntent, decodeAxis1Frame, encVarint, encodeAxis1Frame, extractDtoSchema, hasScope, isAdminOpcode, isKnownOpcode, isTimestampValid, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, validateFrameShape, varintU };
809
+ type UploadSessionStatus = 'ACTIVE' | 'FINALIZING' | 'COMPLETE' | 'ABORTED';
810
+ interface UploadSessionRecord {
811
+ id?: string;
812
+ fileId: string;
813
+ filename?: string;
814
+ status: UploadSessionStatus | string;
815
+ totalSize?: number;
816
+ chunkSize?: number;
817
+ totalChunks?: number;
818
+ receivedBitmap?: Uint8Array | Buffer | null;
819
+ hashState?: Uint8Array | Buffer | null;
820
+ mimeType?: string | null;
821
+ version?: number;
822
+ }
823
+ interface UploadSessionStore {
824
+ findByFileId(fileId: string): Promise<UploadSessionRecord | null>;
825
+ updateStatus(fileId: string, status: UploadSessionStatus, hashState?: Uint8Array | Buffer | null): Promise<void>;
826
+ }
827
+ interface UploadReceiptSigner {
828
+ signActive(message: Uint8Array): {
829
+ kid: string;
830
+ sig: Uint8Array;
831
+ };
832
+ }
833
+ interface UploadFileStat {
834
+ path: string;
835
+ size: number;
836
+ }
837
+ interface UploadFileStore {
838
+ getFinalPath(fileId: string, filename?: string): string;
839
+ getTempPath(fileId: string): string;
840
+ statFinal(fileId: string, filename?: string): Promise<UploadFileStat>;
841
+ readFinalRange(fileId: string, filename: string | undefined, start: number, length: number): Promise<Buffer>;
842
+ hasTemp(fileId: string): Promise<boolean>;
843
+ moveTempToFinal(fileId: string, filename?: string): Promise<string>;
844
+ createTempReadStream(fileId: string): NodeJS.ReadableStream;
845
+ }
846
+
847
+ declare class AxisFilesDownloadHandler implements AxisHandler {
848
+ private readonly sessions;
849
+ private readonly files;
850
+ private readonly logger;
851
+ readonly name = "axis.files.download";
852
+ readonly open = true;
853
+ readonly description = "File download handler";
854
+ constructor(sessions: UploadSessionStore, files: UploadFileStore);
855
+ execute(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<any>;
856
+ }
857
+ declare class AxisFilesFinalizeHandler implements AxisHandler {
858
+ private readonly sessions;
859
+ private readonly files;
860
+ private readonly keyring?;
861
+ private readonly logger;
862
+ readonly name = "axis.files.finalize";
863
+ readonly open = false;
864
+ readonly description = "File upload finalization handler";
865
+ constructor(sessions: UploadSessionStore, files: UploadFileStore, keyring?: UploadReceiptSigner | undefined);
866
+ execute(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<any>;
867
+ }
868
+
869
+ declare const AXIS_UPLOAD_SESSION_STORE = "AXIS_UPLOAD_SESSION_STORE";
870
+ declare const AXIS_UPLOAD_FILE_STORE = "AXIS_UPLOAD_FILE_STORE";
871
+ declare const AXIS_UPLOAD_RECEIPT_SIGNER = "AXIS_UPLOAD_RECEIPT_SIGNER";
872
+
873
+ interface DiskUploadFileStoreOptions {
874
+ uploadDir: string;
875
+ chunkDir: string;
876
+ }
877
+ declare class DiskUploadFileStore implements UploadFileStore {
878
+ private readonly uploadDir;
879
+ private readonly chunkDir;
880
+ constructor(options: DiskUploadFileStoreOptions);
881
+ getFinalPath(fileId: string, filename?: string): string;
882
+ getTempPath(fileId: string): string;
883
+ statFinal(fileId: string, filename?: string): Promise<UploadFileStat>;
884
+ readFinalRange(fileId: string, filename: string | undefined, start: number, length: number): Promise<Buffer>;
885
+ hasTemp(fileId: string): Promise<boolean>;
886
+ moveTempToFinal(fileId: string, filename?: string): Promise<string>;
887
+ createTempReadStream(fileId: string): NodeJS.ReadableStream;
888
+ }
889
+
890
+ export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, AXIS_UPLOAD_FILE_STORE, AXIS_UPLOAD_RECEIPT_SIGNER, AXIS_UPLOAD_SESSION_STORE, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg$1 as AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, AxisFilesDownloadHandler, AxisFilesFinalizeHandler, AxisFrame$1 as AxisFrame, type AxisHandler, type AxisHandlerInit, AxisIdDto, type AxisAlg as AxisJsonAlg, type AxisFrame as AxisJsonFrame, type AxisResponse as AxisJsonResponse, type AxisSig as AxisJsonSig, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, AxisPartialType, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, AxisResponseDto, type AxisSensor, type AxisSensorInit, type AxisSig$1 as AxisSig, AxisTlvDto, CAPABILITIES, type Capability, type CapsuleMode, ContractViolationError, DEFAULT_CONTRACTS, DEFAULT_TIMEOUT, Decision, DiskUploadFileStore, type DtoSchema, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_BODY_KEY, INTENT_METADATA_KEY, INTENT_REQUIREMENTS, INTENT_ROUTES_KEY, INTENT_SENSITIVITY_MAP, INTENT_SENSORS_KEY, INTENT_TIMEOUTS, Intent, IntentBody, type IntentDefinition, type IntentKind, type IntentOptions, type IntentRoute, IntentRouter, IntentSensitivity, IntentSensors, type IntentTlvField, type KeyStatus, PROOF_CAPABILITIES, RESPONSE_TAG_CREATED_AT, RESPONSE_TAG_CREATED_BY, RESPONSE_TAG_ID, RESPONSE_TAG_UPDATED_AT, RESPONSE_TAG_UPDATED_BY, type ReceiptEffect, RiskDecision, type RiskEvaluation, type RiskSignal, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, TLV_FIELDS_KEY, TLV_VALIDATORS_KEY, TlvEnum, TlvField, type TlvFieldKind, type TlvFieldMeta, type TlvFieldOptions, TlvMinLen, TlvRange, TlvUtf8Pattern, TlvValidate, type TlvValidatorFn, type TlvValidatorMeta, type UploadFileStat, type UploadFileStore, type UploadReceiptSigner, type UploadSessionRecord, type UploadSessionStatus, type UploadSessionStore, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildDtoDecoder, buildPacket, buildReceiptHash, buildTLVs, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, classifyIntent, decodeAxis1Frame, encVarint, encodeAxis1Frame, extractDtoSchema, hasScope, isAdminOpcode, isKnownOpcode, isTimestampValid, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, validateFrameShape, varintU };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ModuleRef } from '@nestjs/core';
1
2
  import { AxisFrame as AxisFrame$1 } from './core/index.js';
2
3
  export { AxisBinaryFrame, AxisFrameZ, computeReceiptHash, computeSignaturePayload, decodeFrame, encodeFrame, generateEd25519KeyPair, getSignTarget, sha256, signFrame, verifyFrameSignature } from './core/index.js';
3
4
  export { AXIS_MAGIC, AXIS_VERSION, TLV as AxisTlvType, BodyProfile, ERR_BAD_SIGNATURE, ERR_CONTRACT_VIOLATION, ERR_INVALID_PACKET, ERR_REPLAY_DETECTED, FLAG_BODY_TLV, FLAG_CHAIN_REQ, FLAG_HAS_WITNESS, MAX_BODY_LEN, MAX_FRAME_LEN, MAX_HDR_LEN, MAX_SIG_LEN, NCERT_ALG, NCERT_EXP, NCERT_ISSUER_KID, NCERT_KID, NCERT_NBF, NCERT_NODE_ID, NCERT_PAYLOAD, NCERT_PUB, NCERT_SCOPE, NCERT_SIG, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, PROOF_NONE, PROOF_WITNESS, ProofType, TLV, TLV_ACTOR_ID, TLV_AUD, TLV_BODY_ARR, TLV_BODY_OBJ, TLV_CAPSULE, TLV_EFFECT, TLV_ERROR_CODE, TLV_ERROR_MSG, TLV_INDEX, TLV_INTENT, TLV_KID, TLV_LOOM_PRESENCE_ID, TLV_LOOM_THREAD_HASH, TLV_LOOM_WRIT, TLV_NODE, TLV_NODE_CERT_HASH, TLV_NODE_KID, TLV_NONCE, TLV_OFFSET, TLV_OK, TLV_PID, TLV_PREV_HASH, TLV_PROOF_REF, TLV_PROOF_TYPE, TLV_REALM, TLV_RECEIPT_HASH, TLV_RID, TLV_SHA256_CHUNK, TLV_TRACE_ID, TLV_TS, TLV_UPLOAD_ID, decodeArray, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeTLVs, encodeVarint, varintLength } from '@nextera.one/axis-protocol';
@@ -38,6 +39,12 @@ interface IntentOptions {
38
39
  }
39
40
  declare function Intent(action: string, options?: IntentOptions): MethodDecorator;
40
41
 
42
+ declare const INTENT_BODY_KEY = "axis:intent:body";
43
+ declare function IntentBody(decoder: (buf: Buffer) => any): MethodDecorator;
44
+
45
+ declare const INTENT_SENSORS_KEY = "axis:intent:sensors";
46
+ declare function IntentSensors(sensors: Function[]): MethodDecorator;
47
+
41
48
  declare const TLV_FIELDS_KEY = "axis:tlv:fields";
42
49
  declare const TLV_VALIDATORS_KEY = "axis:tlv:validators";
43
50
  type TlvFieldKind = 'utf8' | 'u64' | 'bytes' | 'bytes16' | 'bool' | 'obj' | 'arr';
@@ -95,6 +102,20 @@ declare abstract class AxisResponseDto extends AxisTlvDto {
95
102
  updated_by?: string;
96
103
  }
97
104
 
105
+ interface IntentSchema {
106
+ intent: string;
107
+ version: number;
108
+ bodyProfile: 'TLV_MAP' | 'RAW' | 'TLV_OBJ' | 'TLV_ARR';
109
+ fields: Array<{
110
+ name: string;
111
+ tlv: number;
112
+ kind: IntentTlvField['kind'];
113
+ required?: boolean;
114
+ maxLen?: number;
115
+ max?: string;
116
+ scope?: 'header' | 'body';
117
+ }>;
118
+ }
98
119
  interface AxisEffect {
99
120
  ok: boolean;
100
121
  effect: string;
@@ -103,11 +124,34 @@ interface AxisEffect {
103
124
  metadata?: any;
104
125
  }
105
126
  declare class IntentRouter {
127
+ private readonly moduleRef?;
128
+ private readonly logger;
129
+ private static readonly BUILTIN_INTENTS;
106
130
  private handlers;
131
+ private intentSensors;
132
+ private intentDecoders;
133
+ private intentSchemas;
134
+ private intentValidators;
135
+ private intentKinds;
136
+ constructor(moduleRef?: ModuleRef | undefined);
137
+ getSchema(intent: string): IntentSchema | undefined;
138
+ getValidators(intent: string): Map<number, TlvValidatorFn[]> | undefined;
139
+ has(intent: string): boolean;
140
+ getRegisteredIntents(): string[];
141
+ getIntentEntry(intent: string): {
142
+ schema?: IntentSchema;
143
+ validators?: Map<number, TlvValidatorFn[]>;
144
+ hasSensors: boolean;
145
+ builtin: boolean;
146
+ kind?: IntentKind;
147
+ } | null;
107
148
  register(intent: string, handler: any): void;
108
149
  registerHandler(instance: any): void;
109
150
  route(frame: AxisFrame$1): Promise<AxisEffect>;
110
- private recordLatency;
151
+ private logIntent;
152
+ registerIntentMeta(intent: string, proto: object, methodName: string): void;
153
+ private runIntentSensors;
154
+ private storeSchema;
111
155
  }
112
156
 
113
157
  declare const ATS1_HDR: {
@@ -438,6 +482,10 @@ interface AxisCapsulePayload {
438
482
  constraints?: AxisCapsuleConstraints;
439
483
  meta?: Record<string, unknown>;
440
484
  }
485
+ interface AxisCapsule {
486
+ payload: AxisCapsulePayload;
487
+ sig: AxisSig$1;
488
+ }
441
489
  interface AxisResponse$1<T = any> {
442
490
  ok: boolean;
443
491
  pid: string;
@@ -758,4 +806,85 @@ interface IntentDefinition {
758
806
  declare function validateFrameShape(frame: any): boolean;
759
807
  declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
760
808
 
761
- export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg$1 as AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, AxisIdDto, type AxisAlg as AxisJsonAlg, type AxisFrame as AxisJsonFrame, type AxisResponse as AxisJsonResponse, type AxisSig as AxisJsonSig, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, AxisPartialType, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, AxisResponseDto, type AxisSensor, type AxisSensorInit, type AxisSig$1 as AxisSig, AxisTlvDto, CAPABILITIES, type Capability, type CapsuleMode, ContractViolationError, DEFAULT_CONTRACTS, DEFAULT_TIMEOUT, Decision, type DtoSchema, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_METADATA_KEY, INTENT_REQUIREMENTS, INTENT_ROUTES_KEY, INTENT_SENSITIVITY_MAP, INTENT_TIMEOUTS, Intent, type IntentDefinition, type IntentKind, type IntentOptions, type IntentRoute, IntentRouter, IntentSensitivity, type IntentTlvField, type KeyStatus, PROOF_CAPABILITIES, RESPONSE_TAG_CREATED_AT, RESPONSE_TAG_CREATED_BY, RESPONSE_TAG_ID, RESPONSE_TAG_UPDATED_AT, RESPONSE_TAG_UPDATED_BY, type ReceiptEffect, RiskDecision, type RiskEvaluation, type RiskSignal, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, TLV_FIELDS_KEY, TLV_VALIDATORS_KEY, TlvEnum, TlvField, type TlvFieldKind, type TlvFieldMeta, type TlvFieldOptions, TlvMinLen, TlvRange, TlvUtf8Pattern, TlvValidate, type TlvValidatorFn, type TlvValidatorMeta, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildDtoDecoder, buildPacket, buildReceiptHash, buildTLVs, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, classifyIntent, decodeAxis1Frame, encVarint, encodeAxis1Frame, extractDtoSchema, hasScope, isAdminOpcode, isKnownOpcode, isTimestampValid, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, validateFrameShape, varintU };
809
+ type UploadSessionStatus = 'ACTIVE' | 'FINALIZING' | 'COMPLETE' | 'ABORTED';
810
+ interface UploadSessionRecord {
811
+ id?: string;
812
+ fileId: string;
813
+ filename?: string;
814
+ status: UploadSessionStatus | string;
815
+ totalSize?: number;
816
+ chunkSize?: number;
817
+ totalChunks?: number;
818
+ receivedBitmap?: Uint8Array | Buffer | null;
819
+ hashState?: Uint8Array | Buffer | null;
820
+ mimeType?: string | null;
821
+ version?: number;
822
+ }
823
+ interface UploadSessionStore {
824
+ findByFileId(fileId: string): Promise<UploadSessionRecord | null>;
825
+ updateStatus(fileId: string, status: UploadSessionStatus, hashState?: Uint8Array | Buffer | null): Promise<void>;
826
+ }
827
+ interface UploadReceiptSigner {
828
+ signActive(message: Uint8Array): {
829
+ kid: string;
830
+ sig: Uint8Array;
831
+ };
832
+ }
833
+ interface UploadFileStat {
834
+ path: string;
835
+ size: number;
836
+ }
837
+ interface UploadFileStore {
838
+ getFinalPath(fileId: string, filename?: string): string;
839
+ getTempPath(fileId: string): string;
840
+ statFinal(fileId: string, filename?: string): Promise<UploadFileStat>;
841
+ readFinalRange(fileId: string, filename: string | undefined, start: number, length: number): Promise<Buffer>;
842
+ hasTemp(fileId: string): Promise<boolean>;
843
+ moveTempToFinal(fileId: string, filename?: string): Promise<string>;
844
+ createTempReadStream(fileId: string): NodeJS.ReadableStream;
845
+ }
846
+
847
+ declare class AxisFilesDownloadHandler implements AxisHandler {
848
+ private readonly sessions;
849
+ private readonly files;
850
+ private readonly logger;
851
+ readonly name = "axis.files.download";
852
+ readonly open = true;
853
+ readonly description = "File download handler";
854
+ constructor(sessions: UploadSessionStore, files: UploadFileStore);
855
+ execute(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<any>;
856
+ }
857
+ declare class AxisFilesFinalizeHandler implements AxisHandler {
858
+ private readonly sessions;
859
+ private readonly files;
860
+ private readonly keyring?;
861
+ private readonly logger;
862
+ readonly name = "axis.files.finalize";
863
+ readonly open = false;
864
+ readonly description = "File upload finalization handler";
865
+ constructor(sessions: UploadSessionStore, files: UploadFileStore, keyring?: UploadReceiptSigner | undefined);
866
+ execute(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<any>;
867
+ }
868
+
869
+ declare const AXIS_UPLOAD_SESSION_STORE = "AXIS_UPLOAD_SESSION_STORE";
870
+ declare const AXIS_UPLOAD_FILE_STORE = "AXIS_UPLOAD_FILE_STORE";
871
+ declare const AXIS_UPLOAD_RECEIPT_SIGNER = "AXIS_UPLOAD_RECEIPT_SIGNER";
872
+
873
+ interface DiskUploadFileStoreOptions {
874
+ uploadDir: string;
875
+ chunkDir: string;
876
+ }
877
+ declare class DiskUploadFileStore implements UploadFileStore {
878
+ private readonly uploadDir;
879
+ private readonly chunkDir;
880
+ constructor(options: DiskUploadFileStoreOptions);
881
+ getFinalPath(fileId: string, filename?: string): string;
882
+ getTempPath(fileId: string): string;
883
+ statFinal(fileId: string, filename?: string): Promise<UploadFileStat>;
884
+ readFinalRange(fileId: string, filename: string | undefined, start: number, length: number): Promise<Buffer>;
885
+ hasTemp(fileId: string): Promise<boolean>;
886
+ moveTempToFinal(fileId: string, filename?: string): Promise<string>;
887
+ createTempReadStream(fileId: string): NodeJS.ReadableStream;
888
+ }
889
+
890
+ export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, AXIS_UPLOAD_FILE_STORE, AXIS_UPLOAD_RECEIPT_SIGNER, AXIS_UPLOAD_SESSION_STORE, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg$1 as AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, AxisFilesDownloadHandler, AxisFilesFinalizeHandler, AxisFrame$1 as AxisFrame, type AxisHandler, type AxisHandlerInit, AxisIdDto, type AxisAlg as AxisJsonAlg, type AxisFrame as AxisJsonFrame, type AxisResponse as AxisJsonResponse, type AxisSig as AxisJsonSig, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, AxisPartialType, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, AxisResponseDto, type AxisSensor, type AxisSensorInit, type AxisSig$1 as AxisSig, AxisTlvDto, CAPABILITIES, type Capability, type CapsuleMode, ContractViolationError, DEFAULT_CONTRACTS, DEFAULT_TIMEOUT, Decision, DiskUploadFileStore, type DtoSchema, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_BODY_KEY, INTENT_METADATA_KEY, INTENT_REQUIREMENTS, INTENT_ROUTES_KEY, INTENT_SENSITIVITY_MAP, INTENT_SENSORS_KEY, INTENT_TIMEOUTS, Intent, IntentBody, type IntentDefinition, type IntentKind, type IntentOptions, type IntentRoute, IntentRouter, IntentSensitivity, IntentSensors, type IntentTlvField, type KeyStatus, PROOF_CAPABILITIES, RESPONSE_TAG_CREATED_AT, RESPONSE_TAG_CREATED_BY, RESPONSE_TAG_ID, RESPONSE_TAG_UPDATED_AT, RESPONSE_TAG_UPDATED_BY, type ReceiptEffect, RiskDecision, type RiskEvaluation, type RiskSignal, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, TLV_FIELDS_KEY, TLV_VALIDATORS_KEY, TlvEnum, TlvField, type TlvFieldKind, type TlvFieldMeta, type TlvFieldOptions, TlvMinLen, TlvRange, TlvUtf8Pattern, TlvValidate, type TlvValidatorFn, type TlvValidatorMeta, type UploadFileStat, type UploadFileStore, type UploadReceiptSigner, type UploadSessionRecord, type UploadSessionStatus, type UploadSessionStore, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildDtoDecoder, buildPacket, buildReceiptHash, buildTLVs, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, classifyIntent, decodeAxis1Frame, encVarint, encodeAxis1Frame, extractDtoSchema, hasScope, isAdminOpcode, isKnownOpcode, isTimestampValid, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, validateFrameShape, varintU };