@jaypie/testkit 1.2.3 → 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.
@@ -1,4 +1,10 @@
1
1
  export declare const getMessages: import("vitest").Mock<(...args: any[]) => any>;
2
+ export declare const getS3FileBuffer: (({ bucket, key }: {
3
+ bucket: string;
4
+ key: string;
5
+ }) => Promise<Buffer>) & {
6
+ mock: any;
7
+ };
2
8
  export declare const getSecret: import("vitest").Mock<(...args: any[]) => any>;
3
9
  export declare const sendMessage: import("vitest").Mock<(...args: any[]) => any>;
4
10
  export declare const getEnvSecret: ((key: string) => Promise<string>) & {
@@ -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,11 +3,20 @@
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
 
10
13
  declare const getMessages: vitest.Mock<(...args: any[]) => any>;
14
+ declare const getS3FileBuffer: (({ bucket, key }: {
15
+ bucket: string;
16
+ key: string;
17
+ }) => Promise<Buffer>) & {
18
+ mock: any;
19
+ };
11
20
  declare const getSecret: vitest.Mock<(...args: any[]) => any>;
12
21
  declare const sendMessage: vitest.Mock<(...args: any[]) => any>;
13
22
  declare const getEnvSecret: ((key: string) => Promise<string>) & {
@@ -305,6 +314,85 @@ declare const submitDistribution: vitest.Mock<(...args: any[]) => any>;
305
314
  declare const submitMetric: vitest.Mock<(...args: any[]) => any>;
306
315
  declare const submitMetricSet: vitest.Mock<(...args: any[]) => any>;
307
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
+
308
396
  declare const EXPRESS: {
309
397
  readonly PATH: {
310
398
  readonly ANY: "*";
@@ -376,20 +464,25 @@ declare const lambdaStreamHandler: ((handler: StreamHandlerFunction, props?: Lam
376
464
  mock: any;
377
465
  };
378
466
 
379
- declare const LLM: typeof original.LLM;
467
+ declare const LLM: typeof original$1.LLM;
380
468
  declare const Llm: vitest.Mock<(...args: any[]) => any> & {
381
469
  operate: vitest.Mock<(...args: any[]) => any>;
382
470
  send: vitest.Mock<(...args: any[]) => any>;
383
471
  };
384
- declare const Toolkit: typeof original.Toolkit;
385
- declare const JaypieToolkit: typeof original.JaypieToolkit;
386
- declare const LlmMessageRole: typeof original.LlmMessageRole;
387
- declare const LlmMessageType: typeof original.LlmMessageType;
388
- declare const LlmStreamChunkType: typeof original.LlmStreamChunkType;
389
- declare const GeminiProvider: typeof original.GeminiProvider;
390
- declare const OpenRouterProvider: typeof original.OpenRouterProvider;
391
- declare const toolkit: original.JaypieToolkit;
392
- 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">[];
393
486
 
394
487
  interface JsonApiError {
395
488
  errors: Array<{
@@ -472,7 +565,22 @@ declare const MarkdownPage: any;
472
565
  */
473
566
  declare const textractJsonToMarkdown: vitest.Mock<(...args: any[]) => any>;
474
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;
475
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
+ }
476
584
  interface LambdaServiceHandlerOptions {
477
585
  chaos?: string;
478
586
  name?: string;
@@ -494,8 +602,69 @@ type HandlerFunction = (...args: unknown[]) => unknown;
494
602
  declare const lambdaServiceHandler: ((handlerOrConfig: ServiceHandlerFunction | LambdaServiceHandlerConfig, options?: LambdaServiceHandlerOptions) => HandlerFunction) & {
495
603
  mock: any;
496
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
+ };
497
666
 
498
667
  declare const mock: Record<string, any>;
499
668
 
500
- 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, forbiddenRoute, force, formatError, formatSSE, getEnvSecret, getHeaderFrom, getMessages, getObjectKeyCaseInsensitive, getSecret, getSingletonMessage, getTextractJob, goneRoute, hasDatadogEnv, isClass, isJaypieError, 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 };
501
- 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 };