@nextera.one/axis-server-sdk 1.6.0 → 1.8.0

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
@@ -126,6 +126,7 @@ __export(index_exports, {
126
126
  RESPONSE_TAG_ID: () => RESPONSE_TAG_ID,
127
127
  RESPONSE_TAG_UPDATED_AT: () => RESPONSE_TAG_UPDATED_AT,
128
128
  RESPONSE_TAG_UPDATED_BY: () => RESPONSE_TAG_UPDATED_BY,
129
+ ResponseObserver: () => ResponseObserver,
129
130
  RiskDecision: () => RiskDecision,
130
131
  SENSOR_METADATA_KEY: () => SENSOR_METADATA_KEY,
131
132
  Schema2002_PasskeyLoginOptionsRes: () => Schema2002_PasskeyLoginOptionsRes,
@@ -159,6 +160,7 @@ __export(index_exports, {
159
160
  TLV_OFFSET: () => import_axis_protocol2.TLV_OFFSET,
160
161
  TLV_OK: () => import_axis_protocol2.TLV_OK,
161
162
  TLV_PID: () => import_axis_protocol2.TLV_PID,
163
+ TLV_PRESENCE_ID: () => import_axis_protocol2.TLV_LOOM_PRESENCE_ID,
162
164
  TLV_PREV_HASH: () => import_axis_protocol2.TLV_PREV_HASH,
163
165
  TLV_PROOF_REF: () => import_axis_protocol2.TLV_PROOF_REF,
164
166
  TLV_PROOF_TYPE: () => import_axis_protocol2.TLV_PROOF_TYPE,
@@ -166,10 +168,12 @@ __export(index_exports, {
166
168
  TLV_RECEIPT_HASH: () => import_axis_protocol2.TLV_RECEIPT_HASH,
167
169
  TLV_RID: () => import_axis_protocol2.TLV_RID,
168
170
  TLV_SHA256_CHUNK: () => import_axis_protocol2.TLV_SHA256_CHUNK,
171
+ TLV_THREAD_HASH: () => import_axis_protocol2.TLV_LOOM_THREAD_HASH,
169
172
  TLV_TRACE_ID: () => import_axis_protocol2.TLV_TRACE_ID,
170
173
  TLV_TS: () => import_axis_protocol2.TLV_TS,
171
174
  TLV_UPLOAD_ID: () => import_axis_protocol2.TLV_UPLOAD_ID,
172
175
  TLV_VALIDATORS_KEY: () => TLV_VALIDATORS_KEY,
176
+ TLV_WRIT: () => import_axis_protocol2.TLV_LOOM_WRIT,
173
177
  TlvEnum: () => TlvEnum,
174
178
  TlvField: () => TlvField,
175
179
  TlvMinLen: () => TlvMinLen,
@@ -192,7 +196,9 @@ __export(index_exports, {
192
196
  canAccessResource: () => canAccessResource,
193
197
  canonicalJson: () => canonicalJson,
194
198
  canonicalJsonExcluding: () => canonicalJsonExcluding,
199
+ canonicalizeGrant: () => canonicalizeGrant,
195
200
  canonicalizeObservation: () => canonicalizeObservation,
201
+ canonicalizeWrit: () => canonicalizeWrit,
196
202
  cce: () => cce_exports,
197
203
  classifyIntent: () => classifyIntent,
198
204
  computeReceiptHash: () => computeReceiptHash,
@@ -209,8 +215,10 @@ __export(index_exports, {
209
215
  decodeTLVsList: () => import_axis_protocol.decodeTLVsList,
210
216
  decodeVarint: () => import_axis_protocol3.decodeVarint,
211
217
  decorators: () => decorators_exports,
218
+ deriveAnchorReflection: () => deriveAnchorReflection,
212
219
  encVarint: () => encVarint,
213
220
  encodeAxis1Frame: () => encodeAxis1Frame,
221
+ encodeAxisTlvDto: () => encodeAxisTlvDto,
214
222
  encodeFrame: () => encodeFrame,
215
223
  encodeQueueMessage: () => encodeQueueMessage,
216
224
  encodeTLVs: () => import_axis_protocol.encodeTLVs,
@@ -1883,6 +1891,7 @@ function verifyResponse(ctx, response) {
1883
1891
  }
1884
1892
  return { passed: true };
1885
1893
  }
1894
+ var ResponseObserver = verifyResponse;
1886
1895
 
1887
1896
  // src/core/varint.ts
1888
1897
  var import_axis_protocol3 = require("@nextera.one/axis-protocol");
@@ -4236,6 +4245,88 @@ AxisSensorChainService = __decorateClass([
4236
4245
  (0, import_common9.Injectable)()
4237
4246
  ], AxisSensorChainService);
4238
4247
 
4248
+ // src/utils/axis-tlv-codec.ts
4249
+ function encodeAxisTlvDto(dtoClass, data) {
4250
+ const schema = extractDtoSchema(dtoClass);
4251
+ const items = schema.fields.flatMap((field) => {
4252
+ const value = data[field.name];
4253
+ if (value === void 0 || value === null) {
4254
+ if (field.required) {
4255
+ throw new Error(`Missing required TLV response field: ${field.name}`);
4256
+ }
4257
+ return [];
4258
+ }
4259
+ return [{ type: field.tag, value: encodeField(field, value) }];
4260
+ });
4261
+ return buildTLVs(items);
4262
+ }
4263
+ function encodeField(field, value) {
4264
+ switch (field.kind) {
4265
+ case "utf8":
4266
+ return Buffer.from(String(value), "utf8");
4267
+ case "u64":
4268
+ return encodeU64(value);
4269
+ case "bytes":
4270
+ case "bytes16":
4271
+ return toBuffer(value);
4272
+ case "bool":
4273
+ return Buffer.from([value ? 1 : 0]);
4274
+ case "obj":
4275
+ case "arr":
4276
+ return Buffer.from(JSON.stringify(value), "utf8");
4277
+ default:
4278
+ return toBuffer(value);
4279
+ }
4280
+ }
4281
+ function encodeU64(value) {
4282
+ const encoded = Buffer.alloc(8);
4283
+ encoded.writeBigUInt64BE(
4284
+ typeof value === "bigint" ? value : BigInt(value)
4285
+ );
4286
+ return encoded;
4287
+ }
4288
+ function toBuffer(value) {
4289
+ if (Buffer.isBuffer(value)) {
4290
+ return value;
4291
+ }
4292
+ if (value instanceof Uint8Array) {
4293
+ return Buffer.from(value);
4294
+ }
4295
+ if (typeof value === "string") {
4296
+ return Buffer.from(value, "utf8");
4297
+ }
4298
+ throw new Error(`Unsupported TLV bytes value: ${typeof value}`);
4299
+ }
4300
+
4301
+ // src/loom/loom.types.ts
4302
+ function deriveAnchorReflection(softid, context = "openlogs", scope = "loom") {
4303
+ return `ar:${context}:${scope}:${softid}`;
4304
+ }
4305
+ function canonicalizeWrit(writ) {
4306
+ const ordered = {
4307
+ head: { tid: writ.head.tid, seq: writ.head.seq },
4308
+ body: {
4309
+ who: writ.body.who,
4310
+ act: writ.body.act,
4311
+ res: writ.body.res,
4312
+ law: writ.body.law
4313
+ },
4314
+ meta: { iat: writ.meta.iat, exp: writ.meta.exp, prev: writ.meta.prev }
4315
+ };
4316
+ return JSON.stringify(ordered);
4317
+ }
4318
+ function canonicalizeGrant(grant) {
4319
+ const ordered = {
4320
+ grant_id: grant.grant_id,
4321
+ issuer: grant.issuer,
4322
+ subject: grant.subject,
4323
+ grant_type: grant.grant_type,
4324
+ caps: grant.caps,
4325
+ meta: grant.meta
4326
+ };
4327
+ return JSON.stringify(ordered);
4328
+ }
4329
+
4239
4330
  // src/cce/index.ts
4240
4331
  var cce_exports = {};
4241
4332
  __export(cce_exports, {
@@ -5281,19 +5372,31 @@ __export(engine_exports, {
5281
5372
  HandlerDiscoveryService: () => HandlerDiscoveryService,
5282
5373
  IntentRouter: () => IntentRouter,
5283
5374
  PRE_DECODE_BOUNDARY: () => PRE_DECODE_BOUNDARY,
5375
+ ResponseObserver: () => ResponseObserver,
5284
5376
  SensorDiscoveryService: () => SensorDiscoveryService,
5285
5377
  SensorRegistry: () => SensorRegistry,
5378
+ buildQueueMessage: () => buildQueueMessage,
5379
+ buildUnsignedWitness: () => buildUnsignedWitness,
5380
+ canonicalizeObservation: () => canonicalizeObservation,
5286
5381
  createObservation: () => createObservation,
5382
+ decodeQueueMessage: () => decodeQueueMessage,
5383
+ encodeQueueMessage: () => encodeQueueMessage,
5287
5384
  endStage: () => endStage,
5288
5385
  finalizeObservation: () => finalizeObservation,
5386
+ hashObservation: () => hashObservation,
5289
5387
  observation: () => observation_exports,
5388
+ parseAutoClaimEntries: () => parseAutoClaimEntries,
5389
+ parseStreamEntries: () => parseStreamEntries,
5290
5390
  recordSensor: () => recordSensor,
5291
- startStage: () => startStage
5391
+ stableJsonStringify: () => stableJsonStringify,
5392
+ startStage: () => startStage,
5393
+ verifyResponse: () => verifyResponse
5292
5394
  });
5293
5395
 
5294
5396
  // src/engine/observation/index.ts
5295
5397
  var observation_exports = {};
5296
5398
  __export(observation_exports, {
5399
+ ResponseObserver: () => ResponseObserver,
5297
5400
  buildQueueMessage: () => buildQueueMessage,
5298
5401
  buildUnsignedWitness: () => buildUnsignedWitness,
5299
5402
  canonicalizeObservation: () => canonicalizeObservation,
@@ -5318,35 +5421,6 @@ __export(loom_exports, {
5318
5421
  deriveAnchorReflection: () => deriveAnchorReflection
5319
5422
  });
5320
5423
 
5321
- // src/loom/loom.types.ts
5322
- function deriveAnchorReflection(softid, context = "openlogs", scope = "loom") {
5323
- return `ar:${context}:${scope}:${softid}`;
5324
- }
5325
- function canonicalizeWrit(writ) {
5326
- const ordered = {
5327
- head: { tid: writ.head.tid, seq: writ.head.seq },
5328
- body: {
5329
- who: writ.body.who,
5330
- act: writ.body.act,
5331
- res: writ.body.res,
5332
- law: writ.body.law
5333
- },
5334
- meta: { iat: writ.meta.iat, exp: writ.meta.exp, prev: writ.meta.prev }
5335
- };
5336
- return JSON.stringify(ordered);
5337
- }
5338
- function canonicalizeGrant(grant) {
5339
- const ordered = {
5340
- grant_id: grant.grant_id,
5341
- issuer: grant.issuer,
5342
- subject: grant.subject,
5343
- grant_type: grant.grant_type,
5344
- caps: grant.caps,
5345
- meta: grant.meta
5346
- };
5347
- return JSON.stringify(ordered);
5348
- }
5349
-
5350
5424
  // src/schemas/index.ts
5351
5425
  var schemas_exports = {};
5352
5426
  __export(schemas_exports, {
@@ -7357,59 +7431,6 @@ var utils_exports = {};
7357
7431
  __export(utils_exports, {
7358
7432
  encodeAxisTlvDto: () => encodeAxisTlvDto
7359
7433
  });
7360
-
7361
- // src/utils/axis-tlv-codec.ts
7362
- function encodeAxisTlvDto(dtoClass, data) {
7363
- const schema = extractDtoSchema(dtoClass);
7364
- const items = schema.fields.flatMap((field) => {
7365
- const value = data[field.name];
7366
- if (value === void 0 || value === null) {
7367
- if (field.required) {
7368
- throw new Error(`Missing required TLV response field: ${field.name}`);
7369
- }
7370
- return [];
7371
- }
7372
- return [{ type: field.tag, value: encodeField(field, value) }];
7373
- });
7374
- return buildTLVs(items);
7375
- }
7376
- function encodeField(field, value) {
7377
- switch (field.kind) {
7378
- case "utf8":
7379
- return Buffer.from(String(value), "utf8");
7380
- case "u64":
7381
- return encodeU64(value);
7382
- case "bytes":
7383
- case "bytes16":
7384
- return toBuffer(value);
7385
- case "bool":
7386
- return Buffer.from([value ? 1 : 0]);
7387
- case "obj":
7388
- case "arr":
7389
- return Buffer.from(JSON.stringify(value), "utf8");
7390
- default:
7391
- return toBuffer(value);
7392
- }
7393
- }
7394
- function encodeU64(value) {
7395
- const encoded = Buffer.alloc(8);
7396
- encoded.writeBigUInt64BE(
7397
- typeof value === "bigint" ? value : BigInt(value)
7398
- );
7399
- return encoded;
7400
- }
7401
- function toBuffer(value) {
7402
- if (Buffer.isBuffer(value)) {
7403
- return value;
7404
- }
7405
- if (value instanceof Uint8Array) {
7406
- return Buffer.from(value);
7407
- }
7408
- if (typeof value === "string") {
7409
- return Buffer.from(value, "utf8");
7410
- }
7411
- throw new Error(`Unsupported TLV bytes value: ${typeof value}`);
7412
- }
7413
7434
  // Annotate the CommonJS export names for ESM import in node:
7414
7435
  0 && (module.exports = {
7415
7436
  ATS1_HDR,
@@ -7500,6 +7521,7 @@ function toBuffer(value) {
7500
7521
  RESPONSE_TAG_ID,
7501
7522
  RESPONSE_TAG_UPDATED_AT,
7502
7523
  RESPONSE_TAG_UPDATED_BY,
7524
+ ResponseObserver,
7503
7525
  RiskDecision,
7504
7526
  SENSOR_METADATA_KEY,
7505
7527
  Schema2002_PasskeyLoginOptionsRes,
@@ -7533,6 +7555,7 @@ function toBuffer(value) {
7533
7555
  TLV_OFFSET,
7534
7556
  TLV_OK,
7535
7557
  TLV_PID,
7558
+ TLV_PRESENCE_ID,
7536
7559
  TLV_PREV_HASH,
7537
7560
  TLV_PROOF_REF,
7538
7561
  TLV_PROOF_TYPE,
@@ -7540,10 +7563,12 @@ function toBuffer(value) {
7540
7563
  TLV_RECEIPT_HASH,
7541
7564
  TLV_RID,
7542
7565
  TLV_SHA256_CHUNK,
7566
+ TLV_THREAD_HASH,
7543
7567
  TLV_TRACE_ID,
7544
7568
  TLV_TS,
7545
7569
  TLV_UPLOAD_ID,
7546
7570
  TLV_VALIDATORS_KEY,
7571
+ TLV_WRIT,
7547
7572
  TlvEnum,
7548
7573
  TlvField,
7549
7574
  TlvMinLen,
@@ -7566,7 +7591,9 @@ function toBuffer(value) {
7566
7591
  canAccessResource,
7567
7592
  canonicalJson,
7568
7593
  canonicalJsonExcluding,
7594
+ canonicalizeGrant,
7569
7595
  canonicalizeObservation,
7596
+ canonicalizeWrit,
7570
7597
  cce,
7571
7598
  classifyIntent,
7572
7599
  computeReceiptHash,
@@ -7583,8 +7610,10 @@ function toBuffer(value) {
7583
7610
  decodeTLVsList,
7584
7611
  decodeVarint,
7585
7612
  decorators,
7613
+ deriveAnchorReflection,
7586
7614
  encVarint,
7587
7615
  encodeAxis1Frame,
7616
+ encodeAxisTlvDto,
7588
7617
  encodeFrame,
7589
7618
  encodeQueueMessage,
7590
7619
  encodeTLVs,