@jaypie/testkit 1.2.7 → 1.2.11

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,5 +1,4 @@
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";
1
+ import type { BaseQueryOptions, DynamoClientConfig, ExportResult, FabricEntity, ParentReference, QueryResult, SeedOptions, SeedResult } from "@jaypie/dynamodb";
3
2
  export declare const APEX = "@";
4
3
  export declare const ARCHIVED_SUFFIX = "#archived";
5
4
  export declare const DELETED_SUFFIX = "#deleted";
@@ -45,37 +44,103 @@ export declare const isInitialized: ((...args: any[]) => any) & {
45
44
  export declare const resetClient: ((...args: any[]) => any) & {
46
45
  mock: any;
47
46
  };
48
- export declare const getEntity: (<T extends FabricEntity = original.FabricEntity>(params: GetEntityParams) => Promise<T | null>) & {
47
+ export declare const getEntity: ((params: {
48
+ id: string;
49
+ model: string;
50
+ }) => Promise<FabricEntity | null>) & {
49
51
  mock: any;
50
52
  };
51
- export declare const putEntity: (<T extends FabricEntity>(params: PutEntityParams<T>) => Promise<T>) & {
53
+ export declare const putEntity: ((params: {
54
+ entity: FabricEntity;
55
+ }) => Promise<FabricEntity>) & {
52
56
  mock: any;
53
57
  };
54
- export declare const updateEntity: (<T extends FabricEntity>(params: UpdateEntityParams<T>) => Promise<T>) & {
58
+ export declare const updateEntity: ((params: {
59
+ entity: FabricEntity;
60
+ }) => Promise<FabricEntity>) & {
55
61
  mock: any;
56
62
  };
57
- export declare const deleteEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
63
+ export declare const deleteEntity: ((params: {
64
+ id: string;
65
+ model: string;
66
+ }) => Promise<boolean>) & {
58
67
  mock: any;
59
68
  };
60
- export declare const archiveEntity: ((params: ArchiveEntityParams) => Promise<boolean>) & {
69
+ export declare const archiveEntity: ((params: {
70
+ id: string;
71
+ model: string;
72
+ }) => Promise<boolean>) & {
61
73
  mock: any;
62
74
  };
63
- export declare const destroyEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
75
+ export declare const destroyEntity: ((params: {
76
+ id: string;
77
+ model: string;
78
+ }) => Promise<boolean>) & {
64
79
  mock: any;
65
80
  };
66
- export declare const queryByOu: (<T extends FabricEntity = original.FabricEntity>(params: QueryByOuParams) => Promise<QueryResult<T>>) & {
81
+ export declare const queryByOu: ((params: {
82
+ model: string;
83
+ ou: string;
84
+ archived?: boolean;
85
+ ascending?: boolean;
86
+ deleted?: boolean;
87
+ limit?: number;
88
+ startKey?: Record<string, unknown>;
89
+ }) => Promise<QueryResult<FabricEntity>>) & {
67
90
  mock: any;
68
91
  };
69
- export declare const queryByAlias: (<T extends FabricEntity = original.FabricEntity>(params: QueryByAliasParams) => Promise<T | null>) & {
92
+ export declare const queryByAlias: ((params: {
93
+ alias: string;
94
+ archived?: boolean;
95
+ deleted?: boolean;
96
+ model: string;
97
+ ou: string;
98
+ }) => Promise<FabricEntity | null>) & {
70
99
  mock: any;
71
100
  };
72
- export declare const queryByClass: (<T extends FabricEntity = original.FabricEntity>(params: QueryByClassParams) => Promise<QueryResult<T>>) & {
101
+ export declare const queryByClass: ((params: {
102
+ archived?: boolean;
103
+ ascending?: boolean;
104
+ deleted?: boolean;
105
+ limit?: number;
106
+ model: string;
107
+ ou: string;
108
+ recordClass: string;
109
+ startKey?: Record<string, unknown>;
110
+ }) => Promise<QueryResult<FabricEntity>>) & {
73
111
  mock: any;
74
112
  };
75
- export declare const queryByType: (<T extends FabricEntity = original.FabricEntity>(params: QueryByTypeParams) => Promise<QueryResult<T>>) & {
113
+ export declare const queryByType: ((params: {
114
+ archived?: boolean;
115
+ ascending?: boolean;
116
+ deleted?: boolean;
117
+ limit?: number;
118
+ model: string;
119
+ ou: string;
120
+ startKey?: Record<string, unknown>;
121
+ type: string;
122
+ }) => Promise<QueryResult<FabricEntity>>) & {
76
123
  mock: any;
77
124
  };
78
- export declare const queryByXid: (<T extends FabricEntity = original.FabricEntity>(params: QueryByXidParams) => Promise<T | null>) & {
125
+ export declare const queryByXid: ((params: {
126
+ archived?: boolean;
127
+ deleted?: boolean;
128
+ model: string;
129
+ ou: string;
130
+ xid: string;
131
+ }) => Promise<FabricEntity | null>) & {
79
132
  mock: any;
80
133
  };
81
- export type { BaseQueryOptions, FabricEntity, ParentReference, QueryResult };
134
+ export declare const seedEntityIfNotExists: (<T extends Partial<FabricEntity>>(entity: T) => Promise<boolean>) & {
135
+ mock: any;
136
+ };
137
+ export declare const seedEntities: (<T extends Partial<FabricEntity>>(entities: T[], options?: SeedOptions) => Promise<SeedResult>) & {
138
+ mock: any;
139
+ };
140
+ export declare const exportEntities: (<T extends FabricEntity>(model: string, ou: string, limit?: number) => Promise<ExportResult<T>>) & {
141
+ mock: any;
142
+ };
143
+ export declare const exportEntitiesToJson: ((model: string, ou: string, pretty?: boolean) => Promise<string>) & {
144
+ mock: any;
145
+ };
146
+ export type { BaseQueryOptions, ExportResult, FabricEntity, ParentReference, QueryResult, SeedOptions, SeedResult, };
@@ -15,6 +15,8 @@ export declare const notFoundRoute: import("vitest").Mock<(...args: any[]) => an
15
15
  export declare const notImplementedRoute: import("vitest").Mock<(...args: any[]) => any>;
16
16
  export declare const expressHttpCodeHandler: import("vitest").Mock<(...args: any[]) => any>;
17
17
  export declare const cors: import("vitest").Mock<(...args: any[]) => any>;
18
+ export declare const createServer: import("vitest").Mock<(...args: any[]) => any>;
19
+ export declare const getCurrentInvokeUuid: import("vitest").Mock<(...args: any[]) => any>;
18
20
  export interface ExpressHandlerFunction {
19
21
  (req: any, res: any, ...extra: any[]): Promise<any> | any;
20
22
  }
@@ -3,10 +3,9 @@
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/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';
6
+ import { ParentReference, FabricEntity, DynamoClientConfig, QueryResult, SeedOptions, SeedResult, ExportResult } from '@jaypie/dynamodb';
7
+ export { BaseQueryOptions, ExportResult, FabricEntity, ParentReference, QueryResult, SeedOptions, SeedResult } from '@jaypie/dynamodb';
8
+ import * as original from '@jaypie/llm';
10
9
  export { FORMAT, LEVEL, Logger, log } from '@jaypie/logger';
11
10
  export { mongoose } from '@jaypie/mongoose';
12
11
 
@@ -359,37 +358,103 @@ declare const isInitialized: ((...args: any[]) => any) & {
359
358
  declare const resetClient: ((...args: any[]) => any) & {
360
359
  mock: any;
361
360
  };
362
- declare const getEntity: (<T extends FabricEntity = original.FabricEntity>(params: GetEntityParams) => Promise<T | null>) & {
361
+ declare const getEntity: ((params: {
362
+ id: string;
363
+ model: string;
364
+ }) => Promise<FabricEntity | null>) & {
363
365
  mock: any;
364
366
  };
365
- declare const putEntity: (<T extends FabricEntity>(params: PutEntityParams<T>) => Promise<T>) & {
367
+ declare const putEntity: ((params: {
368
+ entity: FabricEntity;
369
+ }) => Promise<FabricEntity>) & {
366
370
  mock: any;
367
371
  };
368
- declare const updateEntity: (<T extends FabricEntity>(params: UpdateEntityParams<T>) => Promise<T>) & {
372
+ declare const updateEntity: ((params: {
373
+ entity: FabricEntity;
374
+ }) => Promise<FabricEntity>) & {
369
375
  mock: any;
370
376
  };
371
- declare const deleteEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
377
+ declare const deleteEntity: ((params: {
378
+ id: string;
379
+ model: string;
380
+ }) => Promise<boolean>) & {
372
381
  mock: any;
373
382
  };
374
- declare const archiveEntity: ((params: ArchiveEntityParams) => Promise<boolean>) & {
383
+ declare const archiveEntity: ((params: {
384
+ id: string;
385
+ model: string;
386
+ }) => Promise<boolean>) & {
375
387
  mock: any;
376
388
  };
377
- declare const destroyEntity: ((params: DeleteEntityParams) => Promise<boolean>) & {
389
+ declare const destroyEntity: ((params: {
390
+ id: string;
391
+ model: string;
392
+ }) => Promise<boolean>) & {
378
393
  mock: any;
379
394
  };
380
- declare const queryByOu: (<T extends FabricEntity = original.FabricEntity>(params: QueryByOuParams) => Promise<QueryResult<T>>) & {
395
+ declare const queryByOu: ((params: {
396
+ model: string;
397
+ ou: string;
398
+ archived?: boolean;
399
+ ascending?: boolean;
400
+ deleted?: boolean;
401
+ limit?: number;
402
+ startKey?: Record<string, unknown>;
403
+ }) => Promise<QueryResult<FabricEntity>>) & {
381
404
  mock: any;
382
405
  };
383
- declare const queryByAlias: (<T extends FabricEntity = original.FabricEntity>(params: QueryByAliasParams) => Promise<T | null>) & {
406
+ declare const queryByAlias: ((params: {
407
+ alias: string;
408
+ archived?: boolean;
409
+ deleted?: boolean;
410
+ model: string;
411
+ ou: string;
412
+ }) => Promise<FabricEntity | null>) & {
384
413
  mock: any;
385
414
  };
386
- declare const queryByClass: (<T extends FabricEntity = original.FabricEntity>(params: QueryByClassParams) => Promise<QueryResult<T>>) & {
415
+ declare const queryByClass: ((params: {
416
+ archived?: boolean;
417
+ ascending?: boolean;
418
+ deleted?: boolean;
419
+ limit?: number;
420
+ model: string;
421
+ ou: string;
422
+ recordClass: string;
423
+ startKey?: Record<string, unknown>;
424
+ }) => Promise<QueryResult<FabricEntity>>) & {
387
425
  mock: any;
388
426
  };
389
- declare const queryByType: (<T extends FabricEntity = original.FabricEntity>(params: QueryByTypeParams) => Promise<QueryResult<T>>) & {
427
+ declare const queryByType: ((params: {
428
+ archived?: boolean;
429
+ ascending?: boolean;
430
+ deleted?: boolean;
431
+ limit?: number;
432
+ model: string;
433
+ ou: string;
434
+ startKey?: Record<string, unknown>;
435
+ type: string;
436
+ }) => Promise<QueryResult<FabricEntity>>) & {
437
+ mock: any;
438
+ };
439
+ declare const queryByXid: ((params: {
440
+ archived?: boolean;
441
+ deleted?: boolean;
442
+ model: string;
443
+ ou: string;
444
+ xid: string;
445
+ }) => Promise<FabricEntity | null>) & {
446
+ mock: any;
447
+ };
448
+ declare const seedEntityIfNotExists: (<T extends Partial<FabricEntity>>(entity: T) => Promise<boolean>) & {
449
+ mock: any;
450
+ };
451
+ declare const seedEntities: (<T extends Partial<FabricEntity>>(entities: T[], options?: SeedOptions) => Promise<SeedResult>) & {
452
+ mock: any;
453
+ };
454
+ declare const exportEntities: (<T extends FabricEntity>(model: string, ou: string, limit?: number) => Promise<ExportResult<T>>) & {
390
455
  mock: any;
391
456
  };
392
- declare const queryByXid: (<T extends FabricEntity = original.FabricEntity>(params: QueryByXidParams) => Promise<T | null>) & {
457
+ declare const exportEntitiesToJson: ((model: string, ou: string, pretty?: boolean) => Promise<string>) & {
393
458
  mock: any;
394
459
  };
395
460
 
@@ -410,6 +475,8 @@ declare const notFoundRoute: vitest.Mock<(...args: any[]) => any>;
410
475
  declare const notImplementedRoute: vitest.Mock<(...args: any[]) => any>;
411
476
  declare const expressHttpCodeHandler: vitest.Mock<(...args: any[]) => any>;
412
477
  declare const cors: vitest.Mock<(...args: any[]) => any>;
478
+ declare const createServer: vitest.Mock<(...args: any[]) => any>;
479
+ declare const getCurrentInvokeUuid: vitest.Mock<(...args: any[]) => any>;
413
480
  interface ExpressHandlerFunction {
414
481
  (req: any, res: any, ...extra: any[]): Promise<any> | any;
415
482
  }
@@ -464,25 +531,25 @@ declare const lambdaStreamHandler: ((handler: StreamHandlerFunction, props?: Lam
464
531
  mock: any;
465
532
  };
466
533
 
467
- declare const LLM: typeof original$1.LLM;
534
+ declare const LLM: typeof original.LLM;
468
535
  declare const Llm: vitest.Mock<(...args: any[]) => any> & {
469
536
  operate: vitest.Mock<(...args: any[]) => any>;
470
537
  send: vitest.Mock<(...args: any[]) => any>;
471
538
  };
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">[];
539
+ declare const Toolkit: typeof original.Toolkit;
540
+ declare const JaypieToolkit: typeof original.JaypieToolkit;
541
+ declare const LlmMessageRole: typeof original.LlmMessageRole;
542
+ declare const LlmMessageType: typeof original.LlmMessageType;
543
+ declare const LlmStreamChunkType: typeof original.LlmStreamChunkType;
544
+ declare const GeminiProvider: typeof original.GeminiProvider;
545
+ declare const OpenRouterProvider: typeof original.OpenRouterProvider;
546
+ declare const extractReasoning: typeof original.extractReasoning;
547
+ declare const isLlmOperateInput: typeof original.isLlmOperateInput;
548
+ declare const isLlmOperateInputContent: typeof original.isLlmOperateInputContent;
549
+ declare const isLlmOperateInputFile: typeof original.isLlmOperateInputFile;
550
+ declare const isLlmOperateInputImage: typeof original.isLlmOperateInputImage;
551
+ declare const toolkit: original.JaypieToolkit;
552
+ declare const tools: Omit<original.LlmTool, "call">[];
486
553
 
487
554
  interface JsonApiError {
488
555
  errors: Array<{
@@ -666,5 +733,5 @@ declare const registerMcpTool: ((config: RegisterMcpToolConfig) => RegisterMcpTo
666
733
 
667
734
  declare const mock: Record<string, any>;
668
735
 
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 };
736
+ 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, createServer, mock as default, deleteEntity, destroyEntity, disconnect, echoRoute, envBoolean, envsKey, errorFromStatusCode, exportEntities, exportEntitiesToJson, expressHandler, expressHttpCodeHandler, expressStreamHandler, extractReasoning, forbiddenRoute, force, formatError, formatSSE, getCurrentInvokeUuid, 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, seedEntities, seedEntityIfNotExists, sendBatchMessages, sendMessage, sendTextractJob, sleep, streamToSSE, submitDistribution, submitMetric, submitMetricSet, textractJsonToMarkdown, toolkit, tools, updateEntity, uuid };
670
737
  export type { ExpressHandlerFunction, ExpressHandlerOptions, ExpressStreamHandlerFunction, ExpressStreamHandlerOptions, LambdaOptions, Status };