@jaypie/testkit 1.2.4 → 1.2.7

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.
@@ -0,0 +1,81 @@
1
+ import * as original from "@jaypie/dynamodb";
2
+ import type { ArchiveEntityParams, BaseQueryOptions, DeleteEntityParams, DynamoClientConfig, FabricEntity, GetEntityParams, ParentReference, PutEntityParams, QueryByAliasParams, QueryByClassParams, QueryByOuParams, QueryByTypeParams, QueryByXidParams, QueryResult, UpdateEntityParams } from "@jaypie/dynamodb";
3
+ export declare const APEX = "@";
4
+ export declare const ARCHIVED_SUFFIX = "#archived";
5
+ export declare const DELETED_SUFFIX = "#deleted";
6
+ export declare const INDEX_ALIAS = "indexAlias";
7
+ export declare const INDEX_CLASS = "indexClass";
8
+ export declare const INDEX_OU = "indexOu";
9
+ export declare const INDEX_TYPE = "indexType";
10
+ export declare const INDEX_XID = "indexXid";
11
+ export declare const SEPARATOR = "#";
12
+ export declare const buildIndexAlias: ((ou: string, model: string, alias: string) => string) & {
13
+ mock: any;
14
+ };
15
+ export declare const buildIndexClass: ((ou: string, model: string, recordClass: string) => string) & {
16
+ mock: any;
17
+ };
18
+ export declare const buildIndexOu: ((ou: string, model: string) => string) & {
19
+ mock: any;
20
+ };
21
+ export declare const buildIndexType: ((ou: string, model: string, type: string) => string) & {
22
+ mock: any;
23
+ };
24
+ export declare const buildIndexXid: ((ou: string, model: string, xid: string) => string) & {
25
+ mock: any;
26
+ };
27
+ export declare const calculateOu: ((parent?: ParentReference) => string) & {
28
+ mock: any;
29
+ };
30
+ export declare const indexEntity: (<T extends FabricEntity>(entity: T, suffix?: string) => T) & {
31
+ mock: any;
32
+ };
33
+ export declare const initClient: ((config: DynamoClientConfig) => void) & {
34
+ mock: any;
35
+ };
36
+ export declare const getDocClient: ((...args: any[]) => any) & {
37
+ mock: any;
38
+ };
39
+ export declare const getTableName: ((...args: any[]) => any) & {
40
+ mock: any;
41
+ };
42
+ export declare const isInitialized: ((...args: any[]) => any) & {
43
+ mock: any;
44
+ };
45
+ export declare const resetClient: ((...args: any[]) => any) & {
46
+ mock: any;
47
+ };
48
+ export declare const getEntity: (<T extends FabricEntity = original.FabricEntity>(params: GetEntityParams) => Promise<T | null>) & {
49
+ mock: any;
50
+ };
51
+ export declare const putEntity: (<T extends FabricEntity>(params: PutEntityParams<T>) => Promise<T>) & {
52
+ mock: any;
53
+ };
54
+ export declare const updateEntity: (<T extends FabricEntity>(params: UpdateEntityParams<T>) => Promise<T>) & {
55
+ mock: any;
56
+ };
57
+ export declare const deleteEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
58
+ mock: any;
59
+ };
60
+ export declare const archiveEntity: ((params: ArchiveEntityParams) => Promise<boolean>) & {
61
+ mock: any;
62
+ };
63
+ export declare const destroyEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
64
+ mock: any;
65
+ };
66
+ export declare const queryByOu: (<T extends FabricEntity = original.FabricEntity>(params: QueryByOuParams) => Promise<QueryResult<T>>) & {
67
+ mock: any;
68
+ };
69
+ export declare const queryByAlias: (<T extends FabricEntity = original.FabricEntity>(params: QueryByAliasParams) => Promise<T | null>) & {
70
+ mock: any;
71
+ };
72
+ export declare const queryByClass: (<T extends FabricEntity = original.FabricEntity>(params: QueryByClassParams) => Promise<QueryResult<T>>) & {
73
+ mock: any;
74
+ };
75
+ export declare const queryByType: (<T extends FabricEntity = original.FabricEntity>(params: QueryByTypeParams) => Promise<QueryResult<T>>) & {
76
+ mock: any;
77
+ };
78
+ export declare const queryByXid: (<T extends FabricEntity = original.FabricEntity>(params: QueryByXidParams) => Promise<T | null>) & {
79
+ mock: any;
80
+ };
81
+ export type { BaseQueryOptions, FabricEntity, ParentReference, QueryResult };
@@ -3,7 +3,10 @@
3
3
  import * as vitest from 'vitest';
4
4
  import * as errors from '@jaypie/errors';
5
5
  import * as kit from '@jaypie/kit';
6
- import * as original from '@jaypie/llm';
6
+ import * as original from '@jaypie/dynamodb';
7
+ import { ParentReference, FabricEntity, DynamoClientConfig, GetEntityParams, PutEntityParams, UpdateEntityParams, DeleteEntityParams, ArchiveEntityParams, QueryByOuParams, QueryResult, QueryByAliasParams, QueryByClassParams, QueryByTypeParams, QueryByXidParams } from '@jaypie/dynamodb';
8
+ export { BaseQueryOptions, FabricEntity, ParentReference, QueryResult } from '@jaypie/dynamodb';
9
+ import * as original$1 from '@jaypie/llm';
7
10
  export { FORMAT, LEVEL, Logger, log } from '@jaypie/logger';
8
11
  export { mongoose } from '@jaypie/mongoose';
9
12
 
@@ -311,6 +314,85 @@ declare const submitDistribution: vitest.Mock<(...args: any[]) => any>;
311
314
  declare const submitMetric: vitest.Mock<(...args: any[]) => any>;
312
315
  declare const submitMetricSet: vitest.Mock<(...args: any[]) => any>;
313
316
 
317
+ declare const APEX = "@";
318
+ declare const ARCHIVED_SUFFIX = "#archived";
319
+ declare const DELETED_SUFFIX = "#deleted";
320
+ declare const INDEX_ALIAS = "indexAlias";
321
+ declare const INDEX_CLASS = "indexClass";
322
+ declare const INDEX_OU = "indexOu";
323
+ declare const INDEX_TYPE = "indexType";
324
+ declare const INDEX_XID = "indexXid";
325
+ declare const SEPARATOR = "#";
326
+ declare const buildIndexAlias: ((ou: string, model: string, alias: string) => string) & {
327
+ mock: any;
328
+ };
329
+ declare const buildIndexClass: ((ou: string, model: string, recordClass: string) => string) & {
330
+ mock: any;
331
+ };
332
+ declare const buildIndexOu: ((ou: string, model: string) => string) & {
333
+ mock: any;
334
+ };
335
+ declare const buildIndexType: ((ou: string, model: string, type: string) => string) & {
336
+ mock: any;
337
+ };
338
+ declare const buildIndexXid: ((ou: string, model: string, xid: string) => string) & {
339
+ mock: any;
340
+ };
341
+ declare const calculateOu: ((parent?: ParentReference) => string) & {
342
+ mock: any;
343
+ };
344
+ declare const indexEntity: (<T extends FabricEntity>(entity: T, suffix?: string) => T) & {
345
+ mock: any;
346
+ };
347
+ declare const initClient: ((config: DynamoClientConfig) => void) & {
348
+ mock: any;
349
+ };
350
+ declare const getDocClient: ((...args: any[]) => any) & {
351
+ mock: any;
352
+ };
353
+ declare const getTableName: ((...args: any[]) => any) & {
354
+ mock: any;
355
+ };
356
+ declare const isInitialized: ((...args: any[]) => any) & {
357
+ mock: any;
358
+ };
359
+ declare const resetClient: ((...args: any[]) => any) & {
360
+ mock: any;
361
+ };
362
+ declare const getEntity: (<T extends FabricEntity = original.FabricEntity>(params: GetEntityParams) => Promise<T | null>) & {
363
+ mock: any;
364
+ };
365
+ declare const putEntity: (<T extends FabricEntity>(params: PutEntityParams<T>) => Promise<T>) & {
366
+ mock: any;
367
+ };
368
+ declare const updateEntity: (<T extends FabricEntity>(params: UpdateEntityParams<T>) => Promise<T>) & {
369
+ mock: any;
370
+ };
371
+ declare const deleteEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
372
+ mock: any;
373
+ };
374
+ declare const archiveEntity: ((params: ArchiveEntityParams) => Promise<boolean>) & {
375
+ mock: any;
376
+ };
377
+ declare const destroyEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
378
+ mock: any;
379
+ };
380
+ declare const queryByOu: (<T extends FabricEntity = original.FabricEntity>(params: QueryByOuParams) => Promise<QueryResult<T>>) & {
381
+ mock: any;
382
+ };
383
+ declare const queryByAlias: (<T extends FabricEntity = original.FabricEntity>(params: QueryByAliasParams) => Promise<T | null>) & {
384
+ mock: any;
385
+ };
386
+ declare const queryByClass: (<T extends FabricEntity = original.FabricEntity>(params: QueryByClassParams) => Promise<QueryResult<T>>) & {
387
+ mock: any;
388
+ };
389
+ declare const queryByType: (<T extends FabricEntity = original.FabricEntity>(params: QueryByTypeParams) => Promise<QueryResult<T>>) & {
390
+ mock: any;
391
+ };
392
+ declare const queryByXid: (<T extends FabricEntity = original.FabricEntity>(params: QueryByXidParams) => Promise<T | null>) & {
393
+ mock: any;
394
+ };
395
+
314
396
  declare const EXPRESS: {
315
397
  readonly PATH: {
316
398
  readonly ANY: "*";
@@ -382,25 +464,25 @@ declare const lambdaStreamHandler: ((handler: StreamHandlerFunction, props?: Lam
382
464
  mock: any;
383
465
  };
384
466
 
385
- declare const LLM: typeof original.LLM;
467
+ declare const LLM: typeof original$1.LLM;
386
468
  declare const Llm: vitest.Mock<(...args: any[]) => any> & {
387
469
  operate: vitest.Mock<(...args: any[]) => any>;
388
470
  send: vitest.Mock<(...args: any[]) => any>;
389
471
  };
390
- declare const Toolkit: typeof original.Toolkit;
391
- declare const JaypieToolkit: typeof original.JaypieToolkit;
392
- declare const LlmMessageRole: typeof original.LlmMessageRole;
393
- declare const LlmMessageType: typeof original.LlmMessageType;
394
- declare const LlmStreamChunkType: typeof original.LlmStreamChunkType;
395
- declare const GeminiProvider: typeof original.GeminiProvider;
396
- declare const OpenRouterProvider: typeof original.OpenRouterProvider;
397
- declare const extractReasoning: typeof original.extractReasoning;
398
- declare const isLlmOperateInput: typeof original.isLlmOperateInput;
399
- declare const isLlmOperateInputContent: typeof original.isLlmOperateInputContent;
400
- declare const isLlmOperateInputFile: typeof original.isLlmOperateInputFile;
401
- declare const isLlmOperateInputImage: typeof original.isLlmOperateInputImage;
402
- declare const toolkit: original.JaypieToolkit;
403
- declare const tools: Omit<original.LlmTool, "call">[];
472
+ declare const Toolkit: typeof original$1.Toolkit;
473
+ declare const JaypieToolkit: typeof original$1.JaypieToolkit;
474
+ declare const LlmMessageRole: typeof original$1.LlmMessageRole;
475
+ declare const LlmMessageType: typeof original$1.LlmMessageType;
476
+ declare const LlmStreamChunkType: typeof original$1.LlmStreamChunkType;
477
+ declare const GeminiProvider: typeof original$1.GeminiProvider;
478
+ declare const OpenRouterProvider: typeof original$1.OpenRouterProvider;
479
+ declare const extractReasoning: typeof original$1.extractReasoning;
480
+ declare const isLlmOperateInput: typeof original$1.isLlmOperateInput;
481
+ declare const isLlmOperateInputContent: typeof original$1.isLlmOperateInputContent;
482
+ declare const isLlmOperateInputFile: typeof original$1.isLlmOperateInputFile;
483
+ declare const isLlmOperateInputImage: typeof original$1.isLlmOperateInputImage;
484
+ declare const toolkit: original$1.JaypieToolkit;
485
+ declare const tools: Omit<original$1.LlmTool, "call">[];
404
486
 
405
487
  interface JsonApiError {
406
488
  errors: Array<{
@@ -483,7 +565,22 @@ declare const MarkdownPage: any;
483
565
  */
484
566
  declare const textractJsonToMarkdown: vitest.Mock<(...args: any[]) => any>;
485
567
 
568
+ declare const STATUS_VALUES: readonly ["canceled", "complete", "error", "pending", "processing", "queued", "sending"];
569
+ type Status = (typeof STATUS_VALUES)[number];
570
+ declare const StatusType: ("canceled" | "complete" | "error" | "pending" | "processing" | "queued" | "sending")[];
571
+ declare function isStatus(value: unknown): value is Status;
486
572
  type ServiceHandlerFunction = (input?: Record<string, unknown> | string) => Promise<unknown>;
573
+ interface ServiceHandlerFunctionWithMetadata extends ServiceHandlerFunction {
574
+ alias?: string;
575
+ description?: string;
576
+ input?: Record<string, InputFieldDefinition>;
577
+ }
578
+ interface InputFieldDefinition {
579
+ default?: unknown;
580
+ description?: string;
581
+ required?: boolean;
582
+ type: unknown;
583
+ }
487
584
  interface LambdaServiceHandlerOptions {
488
585
  chaos?: string;
489
586
  name?: string;
@@ -505,8 +602,69 @@ type HandlerFunction = (...args: unknown[]) => unknown;
505
602
  declare const lambdaServiceHandler: ((handlerOrConfig: ServiceHandlerFunction | LambdaServiceHandlerConfig, options?: LambdaServiceHandlerOptions) => HandlerFunction) & {
506
603
  mock: any;
507
604
  };
605
+ interface LlmTool {
606
+ call: (args?: Record<string, unknown>) => Promise<unknown> | unknown;
607
+ description: string;
608
+ message?: string | ((args?: Record<string, unknown>, context?: {
609
+ name: string;
610
+ }) => Promise<string> | string);
611
+ name: string;
612
+ parameters: Record<string, unknown>;
613
+ type: "function" | string;
614
+ }
615
+ interface CreateLlmToolConfig {
616
+ description?: string;
617
+ exclude?: string[];
618
+ handler: ServiceHandlerFunctionWithMetadata;
619
+ message?: string | ((args?: Record<string, unknown>) => string);
620
+ name?: string;
621
+ }
622
+ interface CreateLlmToolResult {
623
+ tool: LlmTool;
624
+ }
625
+ /**
626
+ * Mock implementation of createLlmTool
627
+ * Creates an LLM tool from a vocabulary service handler
628
+ */
629
+ declare const createLlmTool: ((config: CreateLlmToolConfig) => CreateLlmToolResult) & {
630
+ mock: any;
631
+ };
632
+ /**
633
+ * Mock implementation of inputToJsonSchema
634
+ * Converts vocabulary input definitions to JSON Schema
635
+ */
636
+ declare const inputToJsonSchema: ((input?: Record<string, InputFieldDefinition>, options?: {
637
+ exclude?: string[];
638
+ }) => Record<string, unknown>) & {
639
+ mock: any;
640
+ };
641
+ interface McpToolResponse {
642
+ content: Array<{
643
+ text: string;
644
+ type: "text";
645
+ }>;
646
+ }
647
+ interface McpServer {
648
+ tool: (name: string, description: string, schema: Record<string, unknown>, handler: (args: Record<string, unknown>) => Promise<McpToolResponse>) => void;
649
+ }
650
+ interface RegisterMcpToolConfig {
651
+ description?: string;
652
+ handler: ServiceHandlerFunctionWithMetadata;
653
+ name?: string;
654
+ server: McpServer;
655
+ }
656
+ interface RegisterMcpToolResult {
657
+ name: string;
658
+ }
659
+ /**
660
+ * Mock implementation of registerMcpTool
661
+ * Registers a vocabulary service handler as an MCP tool
662
+ */
663
+ declare const registerMcpTool: ((config: RegisterMcpToolConfig) => RegisterMcpToolResult) & {
664
+ mock: any;
665
+ };
508
666
 
509
667
  declare const mock: Record<string, any>;
510
668
 
511
- export { BadGatewayError, BadRequestError, ConfigurationError, CorsError, DATADOG, EXPRESS, ForbiddenError, GatewayTimeoutError, GeminiProvider, GoneError, HTTP, IllogicalError, InternalError, JAYPIE, JaypieError, JaypieStream, JaypieToolkit, LLM, Llm, LlmMessageRole, LlmMessageType, LlmStreamChunkType, MarkdownPage, MethodNotAllowedError, MultiError, NotFoundError, NotImplementedError, OpenRouterProvider, PROJECT, ProjectError, ProjectMultiError, RejectedError, TeapotError, TooManyRequestsError, Toolkit, UnauthorizedError, UnavailableError, UnhandledError, UnreachableCodeError, badRequestRoute, cloneDeep, connect, connectFromSecretEnv, cors, createExpressStream, createJaypieStream, createLambdaStream, createLogger, mock as default, disconnect, echoRoute, envBoolean, envsKey, errorFromStatusCode, expressHandler, expressHttpCodeHandler, expressStreamHandler, extractReasoning, forbiddenRoute, force, formatError, formatSSE, getEnvSecret, getHeaderFrom, getMessages, getObjectKeyCaseInsensitive, getS3FileBuffer, getSecret, getSingletonMessage, getTextractJob, goneRoute, hasDatadogEnv, isClass, isJaypieError, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, isLocalEnv, isNodeTestEnv, isProductionEnv, jaypieErrorFromStatus, jaypieHandler, lambdaHandler, lambdaServiceHandler, lambdaStreamHandler, loadEnvSecrets, methodNotAllowedRoute, noContentRoute, notFoundRoute, notImplementedRoute, placeholders, resolveValue, safeParseFloat, sendBatchMessages, sendMessage, sendTextractJob, sleep, streamToSSE, submitDistribution, submitMetric, submitMetricSet, textractJsonToMarkdown, toolkit, tools, uuid };
512
- export type { ExpressHandlerFunction, ExpressHandlerOptions, ExpressStreamHandlerFunction, ExpressStreamHandlerOptions, LambdaOptions };
669
+ export { APEX, ARCHIVED_SUFFIX, BadGatewayError, BadRequestError, ConfigurationError, CorsError, DATADOG, DELETED_SUFFIX, EXPRESS, ForbiddenError, GatewayTimeoutError, GeminiProvider, GoneError, HTTP, INDEX_ALIAS, INDEX_CLASS, INDEX_OU, INDEX_TYPE, INDEX_XID, IllogicalError, InternalError, JAYPIE, JaypieError, JaypieStream, JaypieToolkit, LLM, Llm, LlmMessageRole, LlmMessageType, LlmStreamChunkType, MarkdownPage, MethodNotAllowedError, MultiError, NotFoundError, NotImplementedError, OpenRouterProvider, PROJECT, ProjectError, ProjectMultiError, RejectedError, SEPARATOR, STATUS_VALUES, StatusType, TeapotError, TooManyRequestsError, Toolkit, UnauthorizedError, UnavailableError, UnhandledError, UnreachableCodeError, archiveEntity, badRequestRoute, buildIndexAlias, buildIndexClass, buildIndexOu, buildIndexType, buildIndexXid, calculateOu, cloneDeep, connect, connectFromSecretEnv, cors, createExpressStream, createJaypieStream, createLambdaStream, createLlmTool, createLogger, mock as default, deleteEntity, destroyEntity, disconnect, echoRoute, envBoolean, envsKey, errorFromStatusCode, expressHandler, expressHttpCodeHandler, expressStreamHandler, extractReasoning, forbiddenRoute, force, formatError, formatSSE, getDocClient, getEntity, getEnvSecret, getHeaderFrom, getMessages, getObjectKeyCaseInsensitive, getS3FileBuffer, getSecret, getSingletonMessage, getTableName, getTextractJob, goneRoute, hasDatadogEnv, indexEntity, initClient, inputToJsonSchema, isClass, isInitialized, isJaypieError, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, isLocalEnv, isNodeTestEnv, isProductionEnv, isStatus, jaypieErrorFromStatus, jaypieHandler, lambdaHandler, lambdaServiceHandler, lambdaStreamHandler, loadEnvSecrets, methodNotAllowedRoute, noContentRoute, notFoundRoute, notImplementedRoute, placeholders, putEntity, queryByAlias, queryByClass, queryByOu, queryByType, queryByXid, registerMcpTool, resetClient, resolveValue, safeParseFloat, sendBatchMessages, sendMessage, sendTextractJob, sleep, streamToSSE, submitDistribution, submitMetric, submitMetricSet, textractJsonToMarkdown, toolkit, tools, updateEntity, uuid };
670
+ export type { ExpressHandlerFunction, ExpressHandlerOptions, ExpressStreamHandlerFunction, ExpressStreamHandlerOptions, LambdaOptions, Status };
@@ -593,6 +593,207 @@ var datadog = /*#__PURE__*/Object.freeze({
593
593
  submitMetricSet: submitMetricSet
594
594
  });
595
595
 
596
+ // Primary markers
597
+ const APEX$1 = "@"; // Root-level marker (DynamoDB prohibits empty strings)
598
+ const SEPARATOR$1 = "#"; // Composite key separator
599
+ // GSI names
600
+ const INDEX_ALIAS$1 = "indexAlias";
601
+ const INDEX_CLASS$1 = "indexClass";
602
+ const INDEX_OU$1 = "indexOu";
603
+ const INDEX_TYPE$1 = "indexType";
604
+ const INDEX_XID$1 = "indexXid";
605
+ // Index suffixes for soft state
606
+ const ARCHIVED_SUFFIX$1 = "#archived";
607
+ const DELETED_SUFFIX$1 = "#deleted";
608
+
609
+ /**
610
+ * Build the indexOu key for hierarchical queries
611
+ * @param ou - The organizational unit (APEX or "{parent.model}#{parent.id}")
612
+ * @param model - The entity model name
613
+ * @returns Composite key: "{ou}#{model}"
614
+ */
615
+ function buildIndexOu$1(ou, model) {
616
+ return `${ou}${SEPARATOR$1}${model}`;
617
+ }
618
+ /**
619
+ * Build the indexAlias key for human-friendly lookups
620
+ * @param ou - The organizational unit
621
+ * @param model - The entity model name
622
+ * @param alias - The human-friendly alias
623
+ * @returns Composite key: "{ou}#{model}#{alias}"
624
+ */
625
+ function buildIndexAlias$1(ou, model, alias) {
626
+ return `${ou}${SEPARATOR$1}${model}${SEPARATOR$1}${alias}`;
627
+ }
628
+ /**
629
+ * Build the indexClass key for category filtering
630
+ * @param ou - The organizational unit
631
+ * @param model - The entity model name
632
+ * @param recordClass - The category classification
633
+ * @returns Composite key: "{ou}#{model}#{class}"
634
+ */
635
+ function buildIndexClass$1(ou, model, recordClass) {
636
+ return `${ou}${SEPARATOR$1}${model}${SEPARATOR$1}${recordClass}`;
637
+ }
638
+ /**
639
+ * Build the indexType key for type filtering
640
+ * @param ou - The organizational unit
641
+ * @param model - The entity model name
642
+ * @param type - The type classification
643
+ * @returns Composite key: "{ou}#{model}#{type}"
644
+ */
645
+ function buildIndexType$1(ou, model, type) {
646
+ return `${ou}${SEPARATOR$1}${model}${SEPARATOR$1}${type}`;
647
+ }
648
+ /**
649
+ * Build the indexXid key for external ID lookups
650
+ * @param ou - The organizational unit
651
+ * @param model - The entity model name
652
+ * @param xid - The external ID
653
+ * @returns Composite key: "{ou}#{model}#{xid}"
654
+ */
655
+ function buildIndexXid$1(ou, model, xid) {
656
+ return `${ou}${SEPARATOR$1}${model}${SEPARATOR$1}${xid}`;
657
+ }
658
+ /**
659
+ * Calculate the organizational unit from a parent reference
660
+ * @param parent - Optional parent entity reference
661
+ * @returns APEX ("@") if no parent, otherwise "{parent.model}#{parent.id}"
662
+ */
663
+ function calculateOu$1(parent) {
664
+ if (!parent) {
665
+ return APEX$1;
666
+ }
667
+ return `${parent.model}${SEPARATOR$1}${parent.id}`;
668
+ }
669
+ /**
670
+ * Auto-populate GSI index keys on an entity
671
+ * - indexOu is always populated from ou + model
672
+ * - indexAlias is populated only when alias is present
673
+ * - indexClass is populated only when class is present
674
+ * - indexType is populated only when type is present
675
+ * - indexXid is populated only when xid is present
676
+ *
677
+ * @param entity - The entity to populate index keys for
678
+ * @param suffix - Optional suffix to append to all index keys (e.g., "#deleted", "#archived")
679
+ * @returns The entity with populated index keys
680
+ */
681
+ function indexEntity$1(entity, suffix = "") {
682
+ const result = { ...entity };
683
+ // indexOu is always set (from ou + model)
684
+ result.indexOu = buildIndexOu$1(entity.ou, entity.model) + suffix;
685
+ // Optional indexes - only set when the source field is present
686
+ if (entity.alias !== undefined) {
687
+ result.indexAlias =
688
+ buildIndexAlias$1(entity.ou, entity.model, entity.alias) + suffix;
689
+ }
690
+ if (entity.class !== undefined) {
691
+ result.indexClass =
692
+ buildIndexClass$1(entity.ou, entity.model, entity.class) + suffix;
693
+ }
694
+ if (entity.type !== undefined) {
695
+ result.indexType =
696
+ buildIndexType$1(entity.ou, entity.model, entity.type) + suffix;
697
+ }
698
+ if (entity.xid !== undefined) {
699
+ result.indexXid =
700
+ buildIndexXid$1(entity.ou, entity.model, entity.xid) + suffix;
701
+ }
702
+ return result;
703
+ }
704
+
705
+ // Re-export constants (no need to mock, just pass through)
706
+ const APEX = APEX$1;
707
+ const ARCHIVED_SUFFIX = ARCHIVED_SUFFIX$1;
708
+ const DELETED_SUFFIX = DELETED_SUFFIX$1;
709
+ const INDEX_ALIAS = INDEX_ALIAS$1;
710
+ const INDEX_CLASS = INDEX_CLASS$1;
711
+ const INDEX_OU = INDEX_OU$1;
712
+ const INDEX_TYPE = INDEX_TYPE$1;
713
+ const INDEX_XID = INDEX_XID$1;
714
+ const SEPARATOR = SEPARATOR$1;
715
+ // Key builder functions - use createMockFunction with typed implementations
716
+ const buildIndexAlias = createMockFunction((ou, model, alias) => buildIndexAlias$1(ou, model, alias));
717
+ const buildIndexClass = createMockFunction((ou, model, recordClass) => buildIndexClass$1(ou, model, recordClass));
718
+ const buildIndexOu = createMockFunction((ou, model) => buildIndexOu$1(ou, model));
719
+ const buildIndexType = createMockFunction((ou, model, type) => buildIndexType$1(ou, model, type));
720
+ const buildIndexXid = createMockFunction((ou, model, xid) => buildIndexXid$1(ou, model, xid));
721
+ const calculateOu = createMockFunction((parent) => calculateOu$1(parent));
722
+ const indexEntity = createMockFunction((entity, suffix) => indexEntity$1(entity, suffix));
723
+ // Client functions
724
+ const initClient = createMockFunction(() => {
725
+ // No-op in mock
726
+ });
727
+ const getDocClient = createMockFunction(() => ({
728
+ send: createMockResolvedFunction({ Items: [] }),
729
+ }));
730
+ const getTableName = createMockFunction(() => "mock-table");
731
+ const isInitialized = createMockFunction(() => true);
732
+ const resetClient = createMockFunction(() => {
733
+ // No-op in mock
734
+ });
735
+ // Entity operations - return mock data
736
+ const getEntity = createMockFunction(async () => null);
737
+ const putEntity = createMockFunction(async (params) => indexEntity$1(params.entity));
738
+ const updateEntity = createMockFunction(async (params) => ({
739
+ ...indexEntity$1(params.entity),
740
+ updatedAt: new Date().toISOString(),
741
+ }));
742
+ const deleteEntity = createMockFunction(async () => true);
743
+ const archiveEntity = createMockFunction(async () => true);
744
+ const destroyEntity = createMockFunction(async () => true);
745
+ // Query functions - return empty results by default (use object params)
746
+ const queryByOu = createMockFunction(async () => ({
747
+ items: [],
748
+ lastEvaluatedKey: undefined,
749
+ }));
750
+ const queryByAlias = createMockFunction(async () => null);
751
+ const queryByClass = createMockFunction(async () => ({
752
+ items: [],
753
+ lastEvaluatedKey: undefined,
754
+ }));
755
+ const queryByType = createMockFunction(async () => ({
756
+ items: [],
757
+ lastEvaluatedKey: undefined,
758
+ }));
759
+ const queryByXid = createMockFunction(async () => null);
760
+
761
+ var dynamodb = /*#__PURE__*/Object.freeze({
762
+ __proto__: null,
763
+ APEX: APEX,
764
+ ARCHIVED_SUFFIX: ARCHIVED_SUFFIX,
765
+ DELETED_SUFFIX: DELETED_SUFFIX,
766
+ INDEX_ALIAS: INDEX_ALIAS,
767
+ INDEX_CLASS: INDEX_CLASS,
768
+ INDEX_OU: INDEX_OU,
769
+ INDEX_TYPE: INDEX_TYPE,
770
+ INDEX_XID: INDEX_XID,
771
+ SEPARATOR: SEPARATOR,
772
+ archiveEntity: archiveEntity,
773
+ buildIndexAlias: buildIndexAlias,
774
+ buildIndexClass: buildIndexClass,
775
+ buildIndexOu: buildIndexOu,
776
+ buildIndexType: buildIndexType,
777
+ buildIndexXid: buildIndexXid,
778
+ calculateOu: calculateOu,
779
+ deleteEntity: deleteEntity,
780
+ destroyEntity: destroyEntity,
781
+ getDocClient: getDocClient,
782
+ getEntity: getEntity,
783
+ getTableName: getTableName,
784
+ indexEntity: indexEntity,
785
+ initClient: initClient,
786
+ isInitialized: isInitialized,
787
+ putEntity: putEntity,
788
+ queryByAlias: queryByAlias,
789
+ queryByClass: queryByClass,
790
+ queryByOu: queryByOu,
791
+ queryByType: queryByType,
792
+ queryByXid: queryByXid,
793
+ resetClient: resetClient,
794
+ updateEntity: updateEntity
795
+ });
796
+
596
797
  /* eslint-disable @typescript-eslint/no-unsafe-function-type */
597
798
  // Constants for mock values
598
799
  const TAG$1 = "EXPRESS";
@@ -1051,6 +1252,21 @@ var textract$1 = /*#__PURE__*/Object.freeze({
1051
1252
  });
1052
1253
 
1053
1254
  // Mock implementations for @jaypie/vocabulary
1255
+ // Status Type - re-export real values (no mocking needed)
1256
+ const STATUS_VALUES = [
1257
+ "canceled",
1258
+ "complete",
1259
+ "error",
1260
+ "pending",
1261
+ "processing",
1262
+ "queued",
1263
+ "sending",
1264
+ ];
1265
+ const StatusType = [...STATUS_VALUES];
1266
+ function isStatus(value) {
1267
+ return (typeof value === "string" &&
1268
+ STATUS_VALUES.includes(value));
1269
+ }
1054
1270
  /**
1055
1271
  * Mock implementation of lambdaServiceHandler
1056
1272
  * Mirrors the real implementation: wraps a service handler for Lambda with getMessages processing
@@ -1098,10 +1314,72 @@ const lambdaServiceHandler = createMockFunction((handlerOrConfig, options = {})
1098
1314
  validate: opts.validate,
1099
1315
  });
1100
1316
  });
1317
+ /**
1318
+ * Mock implementation of createLlmTool
1319
+ * Creates an LLM tool from a vocabulary service handler
1320
+ */
1321
+ const createLlmTool = createMockFunction((config) => {
1322
+ const { description, handler, message, name } = config;
1323
+ const toolName = name ?? handler.alias ?? "tool";
1324
+ const toolDescription = description ?? handler.description ?? "";
1325
+ const tool = {
1326
+ call: async (args) => {
1327
+ return handler(args);
1328
+ },
1329
+ description: toolDescription,
1330
+ name: toolName,
1331
+ parameters: {
1332
+ properties: {},
1333
+ required: [],
1334
+ type: "object",
1335
+ },
1336
+ type: "function",
1337
+ };
1338
+ if (message !== undefined) {
1339
+ tool.message = message;
1340
+ }
1341
+ return { tool };
1342
+ });
1343
+ /**
1344
+ * Mock implementation of inputToJsonSchema
1345
+ * Converts vocabulary input definitions to JSON Schema
1346
+ */
1347
+ const inputToJsonSchema = createMockFunction(() => ({
1348
+ properties: {},
1349
+ required: [],
1350
+ type: "object",
1351
+ }));
1352
+ /**
1353
+ * Mock implementation of registerMcpTool
1354
+ * Registers a vocabulary service handler as an MCP tool
1355
+ */
1356
+ const registerMcpTool = createMockFunction((config) => {
1357
+ const { description, handler, name, server } = config;
1358
+ const toolName = name ?? handler.alias ?? "tool";
1359
+ const toolDescription = description ?? handler.description ?? "";
1360
+ server.tool(toolName, toolDescription, {}, async (args) => {
1361
+ const result = await handler(args);
1362
+ return {
1363
+ content: [
1364
+ {
1365
+ text: result === undefined || result === null ? "" : String(result),
1366
+ type: "text",
1367
+ },
1368
+ ],
1369
+ };
1370
+ });
1371
+ return { name: toolName };
1372
+ });
1101
1373
 
1102
1374
  var vocabulary = /*#__PURE__*/Object.freeze({
1103
1375
  __proto__: null,
1104
- lambdaServiceHandler: lambdaServiceHandler
1376
+ STATUS_VALUES: STATUS_VALUES,
1377
+ StatusType: StatusType,
1378
+ createLlmTool: createLlmTool,
1379
+ inputToJsonSchema: inputToJsonSchema,
1380
+ isStatus: isStatus,
1381
+ lambdaServiceHandler: lambdaServiceHandler,
1382
+ registerMcpTool: registerMcpTool
1105
1383
  });
1106
1384
 
1107
1385
  // Import all mocks
@@ -1113,15 +1391,19 @@ const mock = {
1113
1391
  ...core,
1114
1392
  // Datadog module
1115
1393
  ...datadog,
1394
+ // DynamoDB module
1395
+ ...dynamodb,
1116
1396
  // Express module
1117
1397
  ...express,
1398
+ // Kit module
1118
1399
  ...kit,
1119
1400
  // Lambda module
1120
1401
  ...lambda,
1121
1402
  // LLM module
1122
1403
  ...llm,
1404
+ // Logger module
1123
1405
  ...logger,
1124
- // Mongoose module (now empty)
1406
+ // Mongoose module
1125
1407
  ...mongoose,
1126
1408
  // Textract module
1127
1409
  ...textract$1,
@@ -1129,5 +1411,5 @@ const mock = {
1129
1411
  ...vocabulary,
1130
1412
  };
1131
1413
 
1132
- export { BadGatewayError, BadRequestError, ConfigurationError, CorsError, DATADOG, EXPRESS, ForbiddenError, GatewayTimeoutError, GeminiProvider, GoneError, HTTP$1 as HTTP, IllogicalError, InternalError, JAYPIE, JaypieError, JaypieStream, JaypieToolkit, LLM, Llm, LlmMessageRole, LlmMessageType, LlmStreamChunkType, MarkdownPage, MethodNotAllowedError, MultiError, NotFoundError, NotImplementedError, OpenRouterProvider, PROJECT, ProjectError, ProjectMultiError, RejectedError, TeapotError, TooManyRequestsError, Toolkit, UnauthorizedError, UnavailableError, UnhandledError, UnreachableCodeError, badRequestRoute, cloneDeep, connect, connectFromSecretEnv, cors, createExpressStream, createJaypieStream, createLambdaStream, createLogger, mock as default, disconnect, echoRoute, envBoolean, envsKey, errorFromStatusCode, expressHandler, expressHttpCodeHandler, expressStreamHandler, extractReasoning, forbiddenRoute, force, formatError, formatSSE, getEnvSecret, getHeaderFrom, getMessages, getObjectKeyCaseInsensitive, getS3FileBuffer, getSecret, getSingletonMessage, getTextractJob, goneRoute, hasDatadogEnv, isClass, isJaypieError, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, isLocalEnv, isNodeTestEnv, isProductionEnv, jaypieErrorFromStatus, jaypieHandler, lambdaHandler, lambdaServiceHandler, lambdaStreamHandler, loadEnvSecrets, methodNotAllowedRoute, noContentRoute, notFoundRoute, notImplementedRoute, placeholders, resolveValue, safeParseFloat, sendBatchMessages, sendMessage, sendTextractJob, sleep, streamToSSE, submitDistribution, submitMetric, submitMetricSet, textractJsonToMarkdown, toolkit, tools, uuid };
1414
+ export { APEX, ARCHIVED_SUFFIX, BadGatewayError, BadRequestError, ConfigurationError, CorsError, DATADOG, DELETED_SUFFIX, EXPRESS, ForbiddenError, GatewayTimeoutError, GeminiProvider, GoneError, HTTP$1 as HTTP, INDEX_ALIAS, INDEX_CLASS, INDEX_OU, INDEX_TYPE, INDEX_XID, IllogicalError, InternalError, JAYPIE, JaypieError, JaypieStream, JaypieToolkit, LLM, Llm, LlmMessageRole, LlmMessageType, LlmStreamChunkType, MarkdownPage, MethodNotAllowedError, MultiError, NotFoundError, NotImplementedError, OpenRouterProvider, PROJECT, ProjectError, ProjectMultiError, RejectedError, SEPARATOR, STATUS_VALUES, StatusType, TeapotError, TooManyRequestsError, Toolkit, UnauthorizedError, UnavailableError, UnhandledError, UnreachableCodeError, archiveEntity, badRequestRoute, buildIndexAlias, buildIndexClass, buildIndexOu, buildIndexType, buildIndexXid, calculateOu, cloneDeep, connect, connectFromSecretEnv, cors, createExpressStream, createJaypieStream, createLambdaStream, createLlmTool, createLogger, mock as default, deleteEntity, destroyEntity, disconnect, echoRoute, envBoolean, envsKey, errorFromStatusCode, expressHandler, expressHttpCodeHandler, expressStreamHandler, extractReasoning, forbiddenRoute, force, formatError, formatSSE, getDocClient, getEntity, getEnvSecret, getHeaderFrom, getMessages, getObjectKeyCaseInsensitive, getS3FileBuffer, getSecret, getSingletonMessage, getTableName, getTextractJob, goneRoute, hasDatadogEnv, indexEntity, initClient, inputToJsonSchema, isClass, isInitialized, isJaypieError, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, isLocalEnv, isNodeTestEnv, isProductionEnv, isStatus, jaypieErrorFromStatus, jaypieHandler, lambdaHandler, lambdaServiceHandler, lambdaStreamHandler, loadEnvSecrets, methodNotAllowedRoute, noContentRoute, notFoundRoute, notImplementedRoute, placeholders, putEntity, queryByAlias, queryByClass, queryByOu, queryByType, queryByXid, registerMcpTool, resetClient, resolveValue, safeParseFloat, sendBatchMessages, sendMessage, sendTextractJob, sleep, streamToSSE, submitDistribution, submitMetric, submitMetricSet, textractJsonToMarkdown, toolkit, tools, updateEntity, uuid };
1133
1415
  //# sourceMappingURL=index.js.map