@autobe/agent 0.25.1 → 0.25.3
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/lib/constants/AutoBeConfigConstant.d.ts +1 -1
- package/lib/factory/createAutoBeContext.js +31 -3
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +364 -226
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +8 -8
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +18 -18
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +52 -10
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +25 -25
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +18 -18
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +41 -7
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js +41 -7
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +3 -3
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +9 -4
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +26 -2
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +8 -8
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +20 -20
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +20 -20
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +30 -30
- package/lib/orchestrate/realize/orchestrateRealize.js +13 -15
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +16 -16
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +12 -12
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +21 -13
- package/lib/orchestrate/test/orchestrateTestScenario.js +2 -2
- package/package.json +5 -5
- package/src/constants/AutoBeConfigConstant.ts +1 -1
- package/src/factory/createAutoBeContext.ts +32 -3
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +14 -4
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +4 -5
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +30 -2
- package/src/orchestrate/realize/orchestrateRealize.ts +11 -13
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +21 -13
|
@@ -169,7 +169,7 @@ const claude = {
|
|
|
169
169
|
{
|
|
170
170
|
name: "createDecorator",
|
|
171
171
|
parameters: {
|
|
172
|
-
description: " Properties containing provider, decorator, and payload type
|
|
172
|
+
description: " Properties containing provider, decorator, and payload type\nconfigurations\n\n------------------------------\n\nCurrent Type: {@link IAutoBeRealizeAuthorizationApplication.IProps}",
|
|
173
173
|
type: "object",
|
|
174
174
|
properties: {
|
|
175
175
|
provider: {
|
|
@@ -248,7 +248,7 @@ const claude = {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
},
|
|
251
|
-
description: "Generates authentication provider, decorator, and payload type for
|
|
251
|
+
description: "Generates authentication provider, decorator, and payload type for\nrole-based authorization.\n\nThis method creates a complete authentication infrastructure for a specific\nrole in the NestJS application. It generates three interconnected\ncomponents that work together to provide JWT-based authentication and\nauthorization.\n\nThe generated components include:\n\n- **Provider Function**: Handles JWT verification and user validation from\n database\n- **Decorator**: NestJS parameter decorator for injecting authenticated user\n data\n- **Payload Type**: TypeScript interface defining the authenticated user\n structure\n\nAll components follow strict naming conventions and integrate with the\nexisting authentication architecture using the shared jwtAuthorize\nfunction.",
|
|
252
252
|
validate: (() => { const _io0 = input => "object" === typeof input.provider && null !== input.provider && _io1(input.provider) && ("object" === typeof input.decorator && null !== input.decorator && _io2(input.decorator)) && ("object" === typeof input.payload && null !== input.payload && _io3(input.payload)); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.content; const _io2 = input => "string" === typeof input.name && RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.content; const _io3 = input => "string" === typeof input.name && RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.content; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.provider && null !== input.provider || _report(_exceptionable, {
|
|
253
253
|
path: _path + ".provider",
|
|
254
254
|
expected: "IAutoBeRealizeAuthorizationApplication.IProvider",
|
|
@@ -275,11 +275,11 @@ const claude = {
|
|
|
275
275
|
value: input.payload
|
|
276
276
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
277
277
|
path: _path + ".name",
|
|
278
|
-
expected: "string &
|
|
278
|
+
expected: "string & CamelCasePattern",
|
|
279
279
|
value: input.name
|
|
280
280
|
})) || _report(_exceptionable, {
|
|
281
281
|
path: _path + ".name",
|
|
282
|
-
expected: "(string &
|
|
282
|
+
expected: "(string & CamelCasePattern)",
|
|
283
283
|
value: input.name
|
|
284
284
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
285
285
|
path: _path + ".content",
|
|
@@ -287,11 +287,11 @@ const claude = {
|
|
|
287
287
|
value: input.content
|
|
288
288
|
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
289
289
|
path: _path + ".name",
|
|
290
|
-
expected: "string &
|
|
290
|
+
expected: "string & PascalCasePattern",
|
|
291
291
|
value: input.name
|
|
292
292
|
})) || _report(_exceptionable, {
|
|
293
293
|
path: _path + ".name",
|
|
294
|
-
expected: "(string &
|
|
294
|
+
expected: "(string & PascalCasePattern)",
|
|
295
295
|
value: input.name
|
|
296
296
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
297
297
|
path: _path + ".content",
|
|
@@ -299,11 +299,11 @@ const claude = {
|
|
|
299
299
|
value: input.content
|
|
300
300
|
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
301
301
|
path: _path + ".name",
|
|
302
|
-
expected: "string &
|
|
302
|
+
expected: "string & PascalCasePattern",
|
|
303
303
|
value: input.name
|
|
304
304
|
})) || _report(_exceptionable, {
|
|
305
305
|
path: _path + ".name",
|
|
306
|
-
expected: "(string &
|
|
306
|
+
expected: "(string & PascalCasePattern)",
|
|
307
307
|
value: input.name
|
|
308
308
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
309
309
|
path: _path + ".content",
|
|
@@ -352,7 +352,7 @@ const collection = {
|
|
|
352
352
|
{
|
|
353
353
|
name: "createDecorator",
|
|
354
354
|
parameters: {
|
|
355
|
-
description: " Properties containing provider, decorator, and payload type
|
|
355
|
+
description: " Properties containing provider, decorator, and payload type\nconfigurations\n\n------------------------------\n\nCurrent Type: {@link IAutoBeRealizeAuthorizationApplication.IProps}\n\n### Description of {@link provider} property:\n\n> Authentication Provider function configuration containing the function\n> name and implementation code. The Provider handles JWT token\n> verification, role validation, and database queries to authenticate\n> users.\n\n### Description of {@link decorator} property:\n\n> Authentication Decorator configuration containing the decorator name and\n> implementation code. The Decorator integrates with NestJS parameter\n> decorators to automatically inject authenticated user data into\n> Controller methods.\n\n### Description of {@link payload} property:\n\n> Authentication Payload Type configuration containing the payload type\n> name and implementation code. The Payload Type is used to define the\n> structure of the authenticated user data that will be injected into\n> Controller methods when using the decorator. It serves as the TypeScript\n> type for the parameter in Controller method signatures.",
|
|
356
356
|
type: "object",
|
|
357
357
|
properties: {
|
|
358
358
|
provider: {
|
|
@@ -425,7 +425,7 @@ const collection = {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
},
|
|
428
|
-
description: "Generates authentication provider, decorator, and payload type for
|
|
428
|
+
description: "Generates authentication provider, decorator, and payload type for\nrole-based authorization.\n\nThis method creates a complete authentication infrastructure for a specific\nrole in the NestJS application. It generates three interconnected\ncomponents that work together to provide JWT-based authentication and\nauthorization.\n\nThe generated components include:\n\n- **Provider Function**: Handles JWT verification and user validation from\n database\n- **Decorator**: NestJS parameter decorator for injecting authenticated user\n data\n- **Payload Type**: TypeScript interface defining the authenticated user\n structure\n\nAll components follow strict naming conventions and integrate with the\nexisting authentication architecture using the shared jwtAuthorize\nfunction.",
|
|
429
429
|
validate: (() => { const _io0 = input => "object" === typeof input.provider && null !== input.provider && _io1(input.provider) && ("object" === typeof input.decorator && null !== input.decorator && _io2(input.decorator)) && ("object" === typeof input.payload && null !== input.payload && _io3(input.payload)); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.content; const _io2 = input => "string" === typeof input.name && RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.content; const _io3 = input => "string" === typeof input.name && RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.content; const _vo0 = (input, _path, _exceptionable = true) => [("object" === typeof input.provider && null !== input.provider || _report(_exceptionable, {
|
|
430
430
|
path: _path + ".provider",
|
|
431
431
|
expected: "IAutoBeRealizeAuthorizationApplication.IProvider",
|
|
@@ -452,11 +452,11 @@ const collection = {
|
|
|
452
452
|
value: input.payload
|
|
453
453
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
454
454
|
path: _path + ".name",
|
|
455
|
-
expected: "string &
|
|
455
|
+
expected: "string & CamelCasePattern",
|
|
456
456
|
value: input.name
|
|
457
457
|
})) || _report(_exceptionable, {
|
|
458
458
|
path: _path + ".name",
|
|
459
|
-
expected: "(string &
|
|
459
|
+
expected: "(string & CamelCasePattern)",
|
|
460
460
|
value: input.name
|
|
461
461
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
462
462
|
path: _path + ".content",
|
|
@@ -464,11 +464,11 @@ const collection = {
|
|
|
464
464
|
value: input.content
|
|
465
465
|
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
466
466
|
path: _path + ".name",
|
|
467
|
-
expected: "string &
|
|
467
|
+
expected: "string & PascalCasePattern",
|
|
468
468
|
value: input.name
|
|
469
469
|
})) || _report(_exceptionable, {
|
|
470
470
|
path: _path + ".name",
|
|
471
|
-
expected: "(string &
|
|
471
|
+
expected: "(string & PascalCasePattern)",
|
|
472
472
|
value: input.name
|
|
473
473
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
474
474
|
path: _path + ".content",
|
|
@@ -476,11 +476,11 @@ const collection = {
|
|
|
476
476
|
value: input.content
|
|
477
477
|
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
478
478
|
path: _path + ".name",
|
|
479
|
-
expected: "string &
|
|
479
|
+
expected: "string & PascalCasePattern",
|
|
480
480
|
value: input.name
|
|
481
481
|
})) || _report(_exceptionable, {
|
|
482
482
|
path: _path + ".name",
|
|
483
|
-
expected: "(string &
|
|
483
|
+
expected: "(string & PascalCasePattern)",
|
|
484
484
|
value: input.name
|
|
485
485
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
486
486
|
path: _path + ".content",
|
|
@@ -252,11 +252,11 @@ const claude = {
|
|
|
252
252
|
value: input.payload
|
|
253
253
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
254
254
|
path: _path + ".name",
|
|
255
|
-
expected: "string &
|
|
255
|
+
expected: "string & CamelCasePattern",
|
|
256
256
|
value: input.name
|
|
257
257
|
})) || _report(_exceptionable, {
|
|
258
258
|
path: _path + ".name",
|
|
259
|
-
expected: "(string &
|
|
259
|
+
expected: "(string & CamelCasePattern)",
|
|
260
260
|
value: input.name
|
|
261
261
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
262
262
|
path: _path + ".content",
|
|
@@ -264,11 +264,11 @@ const claude = {
|
|
|
264
264
|
value: input.content
|
|
265
265
|
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
266
266
|
path: _path + ".name",
|
|
267
|
-
expected: "string &
|
|
267
|
+
expected: "string & PascalCasePattern",
|
|
268
268
|
value: input.name
|
|
269
269
|
})) || _report(_exceptionable, {
|
|
270
270
|
path: _path + ".name",
|
|
271
|
-
expected: "(string &
|
|
271
|
+
expected: "(string & PascalCasePattern)",
|
|
272
272
|
value: input.name
|
|
273
273
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
274
274
|
path: _path + ".content",
|
|
@@ -276,11 +276,11 @@ const claude = {
|
|
|
276
276
|
value: input.content
|
|
277
277
|
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
278
278
|
path: _path + ".name",
|
|
279
|
-
expected: "string &
|
|
279
|
+
expected: "string & PascalCasePattern",
|
|
280
280
|
value: input.name
|
|
281
281
|
})) || _report(_exceptionable, {
|
|
282
282
|
path: _path + ".name",
|
|
283
|
-
expected: "(string &
|
|
283
|
+
expected: "(string & PascalCasePattern)",
|
|
284
284
|
value: input.name
|
|
285
285
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
286
286
|
path: _path + ".content",
|
|
@@ -447,11 +447,11 @@ const collection = {
|
|
|
447
447
|
value: input.payload
|
|
448
448
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
449
449
|
path: _path + ".name",
|
|
450
|
-
expected: "string &
|
|
450
|
+
expected: "string & CamelCasePattern",
|
|
451
451
|
value: input.name
|
|
452
452
|
})) || _report(_exceptionable, {
|
|
453
453
|
path: _path + ".name",
|
|
454
|
-
expected: "(string &
|
|
454
|
+
expected: "(string & CamelCasePattern)",
|
|
455
455
|
value: input.name
|
|
456
456
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
457
457
|
path: _path + ".content",
|
|
@@ -459,11 +459,11 @@ const collection = {
|
|
|
459
459
|
value: input.content
|
|
460
460
|
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
461
461
|
path: _path + ".name",
|
|
462
|
-
expected: "string &
|
|
462
|
+
expected: "string & PascalCasePattern",
|
|
463
463
|
value: input.name
|
|
464
464
|
})) || _report(_exceptionable, {
|
|
465
465
|
path: _path + ".name",
|
|
466
|
-
expected: "(string &
|
|
466
|
+
expected: "(string & PascalCasePattern)",
|
|
467
467
|
value: input.name
|
|
468
468
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
469
469
|
path: _path + ".content",
|
|
@@ -471,11 +471,11 @@ const collection = {
|
|
|
471
471
|
value: input.content
|
|
472
472
|
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[A-Z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
|
|
473
473
|
path: _path + ".name",
|
|
474
|
-
expected: "string &
|
|
474
|
+
expected: "string & PascalCasePattern",
|
|
475
475
|
value: input.name
|
|
476
476
|
})) || _report(_exceptionable, {
|
|
477
477
|
path: _path + ".name",
|
|
478
|
-
expected: "(string &
|
|
478
|
+
expected: "(string & PascalCasePattern)",
|
|
479
479
|
value: input.name
|
|
480
480
|
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
481
481
|
path: _path + ".content",
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CamelCasePattern, PascalCasePattern } from "@autobe/interface";
|
|
2
2
|
export interface IAutoBeRealizeAuthorizationApplication {
|
|
3
3
|
/**
|
|
4
|
-
* Generates authentication provider, decorator, and payload type for
|
|
4
|
+
* Generates authentication provider, decorator, and payload type for
|
|
5
|
+
* role-based authorization.
|
|
5
6
|
*
|
|
6
7
|
* This method creates a complete authentication infrastructure for a specific
|
|
7
|
-
* role in the NestJS application. It generates three interconnected
|
|
8
|
-
* that work together to provide JWT-based authentication and
|
|
8
|
+
* role in the NestJS application. It generates three interconnected
|
|
9
|
+
* components that work together to provide JWT-based authentication and
|
|
10
|
+
* authorization.
|
|
9
11
|
*
|
|
10
12
|
* The generated components include:
|
|
11
|
-
* - **Provider Function**: Handles JWT verification and user validation from database
|
|
12
|
-
* - **Decorator**: NestJS parameter decorator for injecting authenticated user data
|
|
13
|
-
* - **Payload Type**: TypeScript interface defining the authenticated user structure
|
|
14
13
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* - **Provider Function**: Handles JWT verification and user validation from
|
|
15
|
+
* database
|
|
16
|
+
* - **Decorator**: NestJS parameter decorator for injecting authenticated user
|
|
17
|
+
* data
|
|
18
|
+
* - **Payload Type**: TypeScript interface defining the authenticated user
|
|
19
|
+
* structure
|
|
17
20
|
*
|
|
18
|
-
*
|
|
21
|
+
* All components follow strict naming conventions and integrate with the
|
|
22
|
+
* existing authentication architecture using the shared jwtAuthorize
|
|
23
|
+
* function.
|
|
24
|
+
*
|
|
25
|
+
* @param next Properties containing provider, decorator, and payload type
|
|
26
|
+
* configurations
|
|
19
27
|
*/
|
|
20
28
|
createDecorator: (next: IAutoBeRealizeAuthorizationApplication.IProps) => void;
|
|
21
29
|
}
|
|
@@ -53,7 +61,7 @@ export declare namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
53
61
|
*
|
|
54
62
|
* DO: Use camelCase naming convention.
|
|
55
63
|
*/
|
|
56
|
-
name: string &
|
|
64
|
+
name: string & CamelCasePattern;
|
|
57
65
|
/**
|
|
58
66
|
* Complete TypeScript code for the authentication Provider function. Must
|
|
59
67
|
* include: JWT token verification using jwtAuthorize function, role type
|
|
@@ -74,7 +82,7 @@ export declare namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
74
82
|
*
|
|
75
83
|
* DO: Use PascalCase naming convention.
|
|
76
84
|
*/
|
|
77
|
-
name: string &
|
|
85
|
+
name: string & PascalCasePattern;
|
|
78
86
|
/**
|
|
79
87
|
* Complete TypeScript code for the authentication Decorator implementation.
|
|
80
88
|
* Must include: SwaggerCustomizer integration to add bearer token security
|
|
@@ -94,7 +102,7 @@ export declare namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
94
102
|
*
|
|
95
103
|
* DO: Use PascalCase naming convention.
|
|
96
104
|
*/
|
|
97
|
-
name: string &
|
|
105
|
+
name: string & PascalCasePattern;
|
|
98
106
|
/**
|
|
99
107
|
* Complete TypeScript code for the Payload type interface in {Role}Payload
|
|
100
108
|
* format (e.g., AdminPayload, UserPayload). Must include: id field with
|
|
@@ -59,7 +59,7 @@ const executeCachedBatch_1 = require("../../utils/executeCachedBatch");
|
|
|
59
59
|
const transformTestScenarioHistories_1 = require("./histories/transformTestScenarioHistories");
|
|
60
60
|
const orchestrateTestScenarioReview_1 = require("./orchestrateTestScenarioReview");
|
|
61
61
|
function orchestrateTestScenario(ctx_1, instruction_1) {
|
|
62
|
-
return __awaiter(this, arguments, void 0, function* (ctx, instruction, capacity =
|
|
62
|
+
return __awaiter(this, arguments, void 0, function* (ctx, instruction, capacity = 2 /* AutoBeConfigConstant.INTERFACE_CAPACITY */) {
|
|
63
63
|
var _a;
|
|
64
64
|
const document = (_a = ctx.state().interface) === null || _a === void 0 ? void 0 : _a.document;
|
|
65
65
|
if (document === undefined) {
|
|
@@ -92,7 +92,7 @@ function orchestrateTestScenario(ctx_1, instruction_1) {
|
|
|
92
92
|
do {
|
|
93
93
|
const matrix = (0, divideArray_1.divideArray)({
|
|
94
94
|
array: include,
|
|
95
|
-
capacity: capacity !== null && capacity !== void 0 ? capacity :
|
|
95
|
+
capacity: capacity !== null && capacity !== void 0 ? capacity : 2 /* AutoBeConfigConstant.INTERFACE_CAPACITY */,
|
|
96
96
|
});
|
|
97
97
|
yield (0, executeCachedBatch_1.executeCachedBatch)(matrix.map((include) => (promptCacheKey) => __awaiter(this, void 0, void 0, function* () {
|
|
98
98
|
exclude.push(...(yield divideAndConquer(ctx, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autobe/agent",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.3",
|
|
4
4
|
"description": "AI backend server code generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Wrtn Technologies",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"tstl": "^3.0.0",
|
|
28
28
|
"typia": "^9.7.2",
|
|
29
29
|
"uuid": "^11.1.0",
|
|
30
|
-
"@autobe/utils": "^0.25.
|
|
31
|
-
"@autobe/interface": "^0.25.
|
|
30
|
+
"@autobe/utils": "^0.25.3",
|
|
31
|
+
"@autobe/interface": "^0.25.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"ts-node": "^10.9.2",
|
|
41
41
|
"ts-patch": "^3.3.0",
|
|
42
42
|
"typescript": "~5.9.2",
|
|
43
|
-
"@autobe/
|
|
44
|
-
"@autobe/
|
|
43
|
+
"@autobe/compiler": "^0.25.3",
|
|
44
|
+
"@autobe/filesystem": "^0.25.3"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
47
47
|
"ai",
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
IAutoBeGetFilesOptions,
|
|
24
24
|
IAutoBeTokenUsageJson,
|
|
25
25
|
} from "@autobe/interface";
|
|
26
|
+
import { StringUtil } from "@autobe/utils";
|
|
26
27
|
import { ILlmSchema } from "@samchon/openapi";
|
|
27
28
|
import { Semaphore } from "tstl";
|
|
28
29
|
import typia from "typia";
|
|
@@ -152,11 +153,31 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
152
153
|
if (closure) closure(agent);
|
|
153
154
|
|
|
154
155
|
// DO CONVERSATE
|
|
156
|
+
const message: string =
|
|
157
|
+
next.enforceFunctionCall === true
|
|
158
|
+
? StringUtil.trim`
|
|
159
|
+
${next.message}
|
|
160
|
+
|
|
161
|
+
> You have to call function(s) of below to accomplish my request.
|
|
162
|
+
>
|
|
163
|
+
> Never hesitate the function calling. Never ask for me permission
|
|
164
|
+
> to execute the function. Never explain me your plan with waiting
|
|
165
|
+
> for my approval.
|
|
166
|
+
>
|
|
167
|
+
> I gave you every information for the function calling, so just
|
|
168
|
+
> call it. I repeat that, never hesitate the function calling.
|
|
169
|
+
> Just do it without any explanation.
|
|
170
|
+
>
|
|
171
|
+
${next.controller.application.functions
|
|
172
|
+
.map((f) => `> - ${f.name}`)
|
|
173
|
+
.join("\n")}
|
|
174
|
+
`
|
|
175
|
+
: next.message;
|
|
155
176
|
const result: TimedConversation.IResult<Model> =
|
|
156
177
|
await TimedConversation.process({
|
|
157
|
-
agent,
|
|
158
178
|
timeout: config.timeout,
|
|
159
|
-
|
|
179
|
+
agent,
|
|
180
|
+
message,
|
|
160
181
|
});
|
|
161
182
|
const tokenUsage: IAutoBeTokenUsageJson.IComponent = agent
|
|
162
183
|
.getTokenUsage()
|
|
@@ -189,7 +210,15 @@ export const createAutoBeContext = <Model extends ILlmSchema.Model>(props: {
|
|
|
189
210
|
) {
|
|
190
211
|
const failure = () => {
|
|
191
212
|
throw new Error(
|
|
192
|
-
`
|
|
213
|
+
StringUtil.trim`
|
|
214
|
+
Failed to function calling in the ${next.source} step.
|
|
215
|
+
|
|
216
|
+
Here is the list of history types that occurred during the conversation:
|
|
217
|
+
|
|
218
|
+
${result.histories.map((h) => `- ${h.type}`).join("\n")}
|
|
219
|
+
|
|
220
|
+
${JSON.stringify(result.histories)}
|
|
221
|
+
`,
|
|
193
222
|
);
|
|
194
223
|
};
|
|
195
224
|
const last: MicroAgenticaHistory<Model> | undefined =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutoBeAnalyzeRole,
|
|
1
|
+
import { AutoBeAnalyzeRole, CamelCasePattern } from "@autobe/interface";
|
|
2
2
|
import { AutoBeAnalyzeFile } from "@autobe/interface/src/histories/contents/AutoBeAnalyzeFile";
|
|
3
3
|
import { tags } from "typia";
|
|
4
4
|
|
|
@@ -31,7 +31,7 @@ export namespace IAutoBeAnalyzeScenarioApplication {
|
|
|
31
31
|
*
|
|
32
32
|
* DO: Use camelCase naming convention.
|
|
33
33
|
*/
|
|
34
|
-
prefix: string &
|
|
34
|
+
prefix: string & CamelCasePattern;
|
|
35
35
|
|
|
36
36
|
/** Roles to be assigned for the project */
|
|
37
37
|
roles: AutoBeAnalyzeRole[];
|
|
@@ -23,7 +23,10 @@ export function orchestrateInterfaceComplement<Model extends ILlmSchema.Model>(
|
|
|
23
23
|
document: AutoBeOpenApi.IDocument;
|
|
24
24
|
},
|
|
25
25
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
26
|
-
return step(ctx, props,
|
|
26
|
+
return step(ctx, props, {
|
|
27
|
+
wasEmpty: false,
|
|
28
|
+
life: 10,
|
|
29
|
+
});
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
async function step<Model extends ILlmSchema.Model>(
|
|
@@ -32,10 +35,14 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
32
35
|
instruction: string;
|
|
33
36
|
document: AutoBeOpenApi.IDocument;
|
|
34
37
|
},
|
|
35
|
-
|
|
38
|
+
progress: {
|
|
39
|
+
wasEmpty: boolean;
|
|
40
|
+
life: number;
|
|
41
|
+
},
|
|
36
42
|
): Promise<Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>> {
|
|
37
43
|
const missed: string[] = missedOpenApiSchemas(props.document);
|
|
38
44
|
if (missed.length === 0) return props.document.components.schemas;
|
|
45
|
+
else if (progress.life === 0) return props.document.components.schemas;
|
|
39
46
|
|
|
40
47
|
const pointer: IPointer<Record<
|
|
41
48
|
string,
|
|
@@ -85,7 +92,7 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
85
92
|
});
|
|
86
93
|
|
|
87
94
|
const empty: boolean = Object.keys(pointer.value).length === 0;
|
|
88
|
-
if (empty === true && wasEmpty === true)
|
|
95
|
+
if (empty === true && progress.wasEmpty === true)
|
|
89
96
|
return props.document.components.schemas;
|
|
90
97
|
|
|
91
98
|
const newSchemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {
|
|
@@ -105,7 +112,10 @@ async function step<Model extends ILlmSchema.Model>(
|
|
|
105
112
|
},
|
|
106
113
|
},
|
|
107
114
|
},
|
|
108
|
-
|
|
115
|
+
{
|
|
116
|
+
wasEmpty: empty,
|
|
117
|
+
life: progress.life - 1,
|
|
118
|
+
},
|
|
109
119
|
);
|
|
110
120
|
}
|
|
111
121
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutoBeOpenApi,
|
|
1
|
+
import { AutoBeOpenApi, CamelCasePattern } from "@autobe/interface";
|
|
2
2
|
import { tags } from "typia";
|
|
3
3
|
|
|
4
4
|
export interface IAutoBeInterfaceOperationApplication {
|
|
@@ -86,8 +86,7 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
86
86
|
* }
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
|
-
export interface IOperation
|
|
90
|
-
extends AutoBeOpenApi.IEndpoint {
|
|
89
|
+
export interface IOperation extends AutoBeOpenApi.IEndpoint {
|
|
91
90
|
/**
|
|
92
91
|
* Specification of the API operation.
|
|
93
92
|
*
|
|
@@ -339,7 +338,7 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
339
338
|
* operations can be uniquely identified in generated SDKs and prevents
|
|
340
339
|
* naming conflicts.
|
|
341
340
|
*/
|
|
342
|
-
name: string &
|
|
341
|
+
name: string & CamelCasePattern;
|
|
343
342
|
|
|
344
343
|
/**
|
|
345
344
|
* Authorization roles required to access this API operation.
|
|
@@ -422,6 +421,6 @@ export namespace IAutoBeInterfaceOperationApplication {
|
|
|
422
421
|
* handled by decorators at the controller level, and the provider function
|
|
423
422
|
* will receive the authenticated user object with the appropriate type.
|
|
424
423
|
*/
|
|
425
|
-
authorizationRoles: Array<string &
|
|
424
|
+
authorizationRoles: Array<string & CamelCasePattern & tags.MinLength<1>>;
|
|
426
425
|
}
|
|
427
426
|
}
|
|
@@ -11,7 +11,8 @@ export namespace JsonSchemaValidator {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const validateSchemas = (props: IProps): void => {
|
|
14
|
-
|
|
14
|
+
validateAuthorization(props);
|
|
15
|
+
validatePrismaSchema(props.errors);
|
|
15
16
|
for (const key of Object.keys(props.schemas))
|
|
16
17
|
validateKey({
|
|
17
18
|
errors: props.errors,
|
|
@@ -121,7 +122,7 @@ export namespace JsonSchemaValidator {
|
|
|
121
122
|
}
|
|
122
123
|
};
|
|
123
124
|
|
|
124
|
-
const
|
|
125
|
+
const validateAuthorization = (props: IProps): void => {
|
|
125
126
|
for (const [key, value] of Object.entries(props.schemas)) {
|
|
126
127
|
if (!key.endsWith(".IAuthorized")) continue;
|
|
127
128
|
else if (AutoBeOpenApiTypeChecker.isObject(value) === false) {
|
|
@@ -146,4 +147,31 @@ export namespace JsonSchemaValidator {
|
|
|
146
147
|
value.required.push("token");
|
|
147
148
|
}
|
|
148
149
|
};
|
|
150
|
+
|
|
151
|
+
const validatePrismaSchema = (errors: IValidation.IError[]): void => {
|
|
152
|
+
for (const e of errors) {
|
|
153
|
+
if (e.path.endsWith(`.properties["x-autobe-prisma-schema"]`) === false)
|
|
154
|
+
continue;
|
|
155
|
+
e.expected =
|
|
156
|
+
"undefined value (remove this property and re-define it in the root schema)";
|
|
157
|
+
e.description = StringUtil.trim`
|
|
158
|
+
You have defined a property named "x-autobe-prisma-schema"
|
|
159
|
+
somewhere wrong place.
|
|
160
|
+
|
|
161
|
+
You have defined a property name "x-autobe-prisma-schema" as
|
|
162
|
+
an object type. However, this "x-autobe-prisma-schema" property
|
|
163
|
+
must be defined only in the root schema object as a metadata,
|
|
164
|
+
not in the nested object property.
|
|
165
|
+
|
|
166
|
+
Remove this property at the next time, and re-define it in the
|
|
167
|
+
root object schema.
|
|
168
|
+
|
|
169
|
+
- Current path (wrong): ${e.path}
|
|
170
|
+
- Must be (object root): ${e.path.replace(
|
|
171
|
+
`.properties["x-autobe-prisma-schema"]`,
|
|
172
|
+
`["x-autobe-prisma-schema"]`,
|
|
173
|
+
)}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
149
177
|
}
|
|
@@ -76,23 +76,21 @@ export const orchestrateRealize =
|
|
|
76
76
|
const writes: AutoBeRealizeWriteEvent[] = (
|
|
77
77
|
await executeCachedBatch(
|
|
78
78
|
artifacts.map((art) => async (promptCacheKey) => {
|
|
79
|
-
const
|
|
80
|
-
totalAuthorizations: authorizations,
|
|
81
|
-
authorization: art.decoratorEvent ?? null,
|
|
82
|
-
scenario: art,
|
|
83
|
-
document,
|
|
84
|
-
progress: writeProgress,
|
|
85
|
-
promptCacheKey,
|
|
86
|
-
};
|
|
87
|
-
try {
|
|
88
|
-
return await orchestrateRealizeWrite(ctx, props);
|
|
89
|
-
} catch {
|
|
79
|
+
const write = async (): Promise<AutoBeRealizeWriteEvent | null> => {
|
|
90
80
|
try {
|
|
91
|
-
return await orchestrateRealizeWrite(ctx,
|
|
81
|
+
return await orchestrateRealizeWrite(ctx, {
|
|
82
|
+
totalAuthorizations: authorizations,
|
|
83
|
+
authorization: art.decoratorEvent ?? null,
|
|
84
|
+
scenario: art,
|
|
85
|
+
document,
|
|
86
|
+
progress: writeProgress,
|
|
87
|
+
promptCacheKey,
|
|
88
|
+
});
|
|
92
89
|
} catch {
|
|
93
90
|
return null;
|
|
94
91
|
}
|
|
95
|
-
}
|
|
92
|
+
};
|
|
93
|
+
return (await write()) ?? (await write());
|
|
96
94
|
}),
|
|
97
95
|
)
|
|
98
96
|
).filter((w) => w !== null);
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CamelCasePattern, PascalCasePattern } from "@autobe/interface";
|
|
2
2
|
|
|
3
3
|
export interface IAutoBeRealizeAuthorizationApplication {
|
|
4
4
|
/**
|
|
5
|
-
* Generates authentication provider, decorator, and payload type for
|
|
5
|
+
* Generates authentication provider, decorator, and payload type for
|
|
6
|
+
* role-based authorization.
|
|
6
7
|
*
|
|
7
8
|
* This method creates a complete authentication infrastructure for a specific
|
|
8
|
-
* role in the NestJS application. It generates three interconnected
|
|
9
|
-
* that work together to provide JWT-based authentication and
|
|
9
|
+
* role in the NestJS application. It generates three interconnected
|
|
10
|
+
* components that work together to provide JWT-based authentication and
|
|
11
|
+
* authorization.
|
|
10
12
|
*
|
|
11
13
|
* The generated components include:
|
|
12
|
-
* - **Provider Function**: Handles JWT verification and user validation from database
|
|
13
|
-
* - **Decorator**: NestJS parameter decorator for injecting authenticated user data
|
|
14
|
-
* - **Payload Type**: TypeScript interface defining the authenticated user structure
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* - **Provider Function**: Handles JWT verification and user validation from
|
|
16
|
+
* database
|
|
17
|
+
* - **Decorator**: NestJS parameter decorator for injecting authenticated user
|
|
18
|
+
* data
|
|
19
|
+
* - **Payload Type**: TypeScript interface defining the authenticated user
|
|
20
|
+
* structure
|
|
18
21
|
*
|
|
19
|
-
*
|
|
22
|
+
* All components follow strict naming conventions and integrate with the
|
|
23
|
+
* existing authentication architecture using the shared jwtAuthorize
|
|
24
|
+
* function.
|
|
25
|
+
*
|
|
26
|
+
* @param next Properties containing provider, decorator, and payload type
|
|
27
|
+
* configurations
|
|
20
28
|
*/
|
|
21
29
|
createDecorator: (
|
|
22
30
|
next: IAutoBeRealizeAuthorizationApplication.IProps,
|
|
@@ -60,7 +68,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
60
68
|
*
|
|
61
69
|
* DO: Use camelCase naming convention.
|
|
62
70
|
*/
|
|
63
|
-
name: string &
|
|
71
|
+
name: string & CamelCasePattern;
|
|
64
72
|
|
|
65
73
|
/**
|
|
66
74
|
* Complete TypeScript code for the authentication Provider function. Must
|
|
@@ -83,7 +91,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
83
91
|
*
|
|
84
92
|
* DO: Use PascalCase naming convention.
|
|
85
93
|
*/
|
|
86
|
-
name: string &
|
|
94
|
+
name: string & PascalCasePattern;
|
|
87
95
|
|
|
88
96
|
/**
|
|
89
97
|
* Complete TypeScript code for the authentication Decorator implementation.
|
|
@@ -105,7 +113,7 @@ export namespace IAutoBeRealizeAuthorizationApplication {
|
|
|
105
113
|
*
|
|
106
114
|
* DO: Use PascalCase naming convention.
|
|
107
115
|
*/
|
|
108
|
-
name: string &
|
|
116
|
+
name: string & PascalCasePattern;
|
|
109
117
|
|
|
110
118
|
/**
|
|
111
119
|
* Complete TypeScript code for the Payload type interface in {Role}Payload
|