@aigne/core 0.4.209 → 0.4.211-beta.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.
Files changed (56) hide show
  1. package/lib/cjs/api-agent.js +70 -0
  2. package/lib/cjs/data-type-schema.js +46 -0
  3. package/lib/cjs/data-type.js +2 -0
  4. package/lib/cjs/definitions/api-parameter.js +10 -0
  5. package/lib/cjs/definitions/data-type-schema.js +3 -3
  6. package/lib/cjs/definitions/open-api.js +2 -0
  7. package/lib/cjs/index.js +3 -0
  8. package/lib/cjs/memory.js +32 -0
  9. package/lib/cjs/open-api-agent.js +62 -0
  10. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  11. package/lib/cjs/utils/constants.js +4 -0
  12. package/lib/cjs/utils/fetch-api.js +35 -0
  13. package/lib/cjs/utils/fetch-open-api.js +30 -0
  14. package/lib/cjs/utils/fetch.js +20 -0
  15. package/lib/cjs/utils/flatten-openapi.js +14 -0
  16. package/lib/cjs/utils/format-parameter.js +126 -0
  17. package/lib/cjs/utils/index.js +3 -0
  18. package/lib/cjs/utils/open-api-parameter.js +84 -0
  19. package/lib/esm/api-agent.js +67 -0
  20. package/lib/esm/data-type-schema.js +43 -0
  21. package/lib/esm/data-type.js +1 -0
  22. package/lib/esm/definitions/api-parameter.js +7 -0
  23. package/lib/esm/definitions/data-type-schema.js +1 -1
  24. package/lib/esm/definitions/open-api.js +1 -0
  25. package/lib/esm/index.js +3 -0
  26. package/lib/esm/memory.js +27 -0
  27. package/lib/esm/open-api-agent.js +59 -0
  28. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  29. package/lib/esm/utils/constants.js +1 -0
  30. package/lib/esm/utils/fetch-api.js +31 -0
  31. package/lib/esm/utils/fetch-open-api.js +26 -0
  32. package/lib/esm/utils/fetch.js +17 -0
  33. package/lib/esm/utils/flatten-openapi.js +11 -0
  34. package/lib/esm/utils/format-parameter.js +116 -0
  35. package/lib/esm/utils/index.js +3 -0
  36. package/lib/esm/utils/open-api-parameter.js +78 -0
  37. package/lib/types/api-agent.d.ts +53 -0
  38. package/lib/types/context.d.ts +1 -0
  39. package/lib/types/data-type-schema.d.ts +46 -0
  40. package/lib/types/data-type.d.ts +32 -0
  41. package/lib/types/definitions/api-parameter.d.ts +55 -0
  42. package/lib/types/definitions/data-type-schema.d.ts +1 -1
  43. package/lib/types/definitions/open-api.d.ts +36 -0
  44. package/lib/types/index.d.ts +3 -0
  45. package/lib/types/memory.d.ts +184 -0
  46. package/lib/types/open-api-agent.d.ts +55 -0
  47. package/lib/types/tsconfig.tsbuildinfo +1 -1
  48. package/lib/types/utils/constants.d.ts +1 -0
  49. package/lib/types/utils/fetch-api.d.ts +3 -0
  50. package/lib/types/utils/fetch-open-api.d.ts +2 -0
  51. package/lib/types/utils/fetch.d.ts +1 -0
  52. package/lib/types/utils/flatten-openapi.d.ts +25 -0
  53. package/lib/types/utils/format-parameter.d.ts +6 -0
  54. package/lib/types/utils/index.d.ts +3 -0
  55. package/lib/types/utils/open-api-parameter.d.ts +7 -0
  56. package/package.json +2 -20
@@ -0,0 +1 @@
1
+ export declare const FETCH_TIMEOUT: number;
@@ -0,0 +1,3 @@
1
+ import { FetchRequest } from '../definitions/api-parameter';
2
+ export declare const fetchApi: (request: FetchRequest) => Promise<any>;
3
+ export default fetchApi;
@@ -0,0 +1,2 @@
1
+ import type { FetchRequest } from '../definitions/open-api';
2
+ export declare const fetchOpenApi: (request: FetchRequest) => Promise<any>;
@@ -0,0 +1 @@
1
+ export declare function checkFetchResponse(result: Response): Promise<Response>;
@@ -0,0 +1,25 @@
1
+ export declare function flattenApiStructure(apiStructure: {
2
+ paths: {
3
+ [key: string]: {
4
+ [key: string]: {
5
+ 'x-id': string;
6
+ 'x-did': string;
7
+ 'x-path': string;
8
+ 'x-method': string;
9
+ type: string;
10
+ summary?: string;
11
+ description?: string;
12
+ };
13
+ };
14
+ };
15
+ }): {
16
+ id: string;
17
+ type: string;
18
+ url?: string;
19
+ name?: string;
20
+ did?: string;
21
+ path: string;
22
+ method: string;
23
+ summary?: string;
24
+ description?: string;
25
+ }[];
@@ -0,0 +1,6 @@
1
+ import { API, AuthConfig, AuthResult, FetchRequest, ParametersResult } from '../definitions/api-parameter';
2
+ import { RunnableDefinition } from '../runnable';
3
+ export declare function getAuthParams(auth?: AuthConfig): AuthResult;
4
+ export declare function processParameters(api: API, inputs: RunnableDefinition['inputs'], input: Record<string, any>): ParametersResult;
5
+ export declare function mergeParameters(parameters: AuthResult, authParams: AuthResult): AuthResult;
6
+ export declare const formatRequest: (api: API, inputs: RunnableDefinition["inputs"], input: Record<string, any>) => FetchRequest;
@@ -1,7 +1,10 @@
1
+ export * from './fetch';
2
+ export * from './fetch-open-api';
1
3
  export * from './is-non-nullable';
2
4
  export * from './mustache-utils';
3
5
  export * from './nullable';
4
6
  export * from './omit';
7
+ export * from './open-api-parameter';
5
8
  export * from './ordered-map';
6
9
  export * from './stream-utils';
7
10
  export * from './union';
@@ -0,0 +1,7 @@
1
+ import type { AuthConfig, FetchRequest, HTTPMethod } from '../definitions/open-api';
2
+ import type { OpenAPIAgentDefinition } from '../open-api-agent';
3
+ export declare function formatOpenAPIRequest(api: {
4
+ url: string;
5
+ method: HTTPMethod;
6
+ auth?: AuthConfig;
7
+ }, inputs: OpenAPIAgentDefinition['inputs'], input: Record<string, any>): Promise<FetchRequest>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "0.4.209",
3
+ "version": "0.4.211-beta.1",
4
4
  "description": "AIGNE core library",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,36 +23,18 @@
23
23
  "url": "git+https://github.com/blocklet/ai-studio.git"
24
24
  },
25
25
  "dependencies": {
26
- "@abtnode/client": "^1.16.37",
27
- "@blocklet/sdk": "^1.16.37",
28
26
  "@types/mustache": "^4.2.5",
29
- "axios": "^1.7.5",
30
- "cron": "^3.1.7",
31
- "fast-deep-equal": "^3.1.3",
32
- "fastq": "^1.17.1",
33
- "fs-extra": "^11.2.0",
34
- "glob": "^10.4.5",
35
- "joi": "^17.13.3",
36
- "js-base64": "^3.7.7",
37
- "js-cookie": "^3.0.5",
38
- "json-logic-js": "^2.0.5",
39
- "json-stable-stringify": "^1.1.1",
40
27
  "lodash": "^4.17.21",
41
28
  "mustache": "^4.2.0",
42
29
  "nanoid": "^3.3.7",
43
- "openapi3-ts": "^4.3.3",
44
- "react-querybuilder": "^7.7.1",
45
- "snowflake-uuid": "^1.0.0",
46
30
  "tsyringe": "^4.8.0",
47
- "ufo": "^1.5.4",
48
- "yaml": "^2.5.0"
31
+ "ufo": "^1.5.4"
49
32
  },
50
33
  "devDependencies": {
51
34
  "@tsconfig/recommended": "^1.0.8",
52
35
  "@types/bun": "^1.1.16",
53
36
  "npm-run-all": "^4.1.5",
54
37
  "rimraf": "^6.0.1",
55
- "ts-jest": "^29.2.5",
56
38
  "typescript": "^5.5.4"
57
39
  },
58
40
  "scripts": {