@zudojs/api 0.0.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.
- package/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/api/constants.d.ts +18 -0
- package/dist/api/constants.d.ts.map +1 -0
- package/dist/api/constants.js +18 -0
- package/dist/api/constants.js.map +1 -0
- package/dist/api/context/context.type.d.ts +22 -0
- package/dist/api/context/context.type.d.ts.map +1 -0
- package/dist/api/context/context.type.js +25 -0
- package/dist/api/context/context.type.js.map +1 -0
- package/dist/api/context/contextKey.type.d.ts +28 -0
- package/dist/api/context/contextKey.type.d.ts.map +1 -0
- package/dist/api/context/contextKey.type.js +31 -0
- package/dist/api/context/contextKey.type.js.map +1 -0
- package/dist/api/errors/index.d.ts +10 -0
- package/dist/api/errors/index.d.ts.map +1 -0
- package/dist/api/errors/index.js +9 -0
- package/dist/api/errors/index.js.map +1 -0
- package/dist/api/executor/executor.core.d.ts +33 -0
- package/dist/api/executor/executor.core.d.ts.map +1 -0
- package/dist/api/executor/executor.core.js +62 -0
- package/dist/api/executor/executor.core.js.map +1 -0
- package/dist/api/executor/index.d.ts +3 -0
- package/dist/api/executor/index.d.ts.map +1 -0
- package/dist/api/executor/index.js +3 -0
- package/dist/api/executor/index.js.map +1 -0
- package/dist/api/handler/handler.type.d.ts +9 -0
- package/dist/api/handler/handler.type.d.ts.map +1 -0
- package/dist/api/handler/handler.type.js +2 -0
- package/dist/api/handler/handler.type.js.map +1 -0
- package/dist/api/interceptors/interceptor.type.d.ts +25 -0
- package/dist/api/interceptors/interceptor.type.d.ts.map +1 -0
- package/dist/api/interceptors/interceptor.type.js +11 -0
- package/dist/api/interceptors/interceptor.type.js.map +1 -0
- package/dist/api/operation/operation.type.d.ts +42 -0
- package/dist/api/operation/operation.type.d.ts.map +1 -0
- package/dist/api/operation/operation.type.js +12 -0
- package/dist/api/operation/operation.type.js.map +1 -0
- package/dist/api/registry/index.d.ts +2 -0
- package/dist/api/registry/index.d.ts.map +1 -0
- package/dist/api/registry/index.js +2 -0
- package/dist/api/registry/index.js.map +1 -0
- package/dist/api/registry/operationRegistry.core.d.ts +49 -0
- package/dist/api/registry/operationRegistry.core.d.ts.map +1 -0
- package/dist/api/registry/operationRegistry.core.js +80 -0
- package/dist/api/registry/operationRegistry.core.js.map +1 -0
- package/dist/api/result/apiResult.type.d.ts +36 -0
- package/dist/api/result/apiResult.type.d.ts.map +1 -0
- package/dist/api/result/apiResult.type.js +25 -0
- package/dist/api/result/apiResult.type.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/api
|
|
3
|
+
*
|
|
4
|
+
* Application-facing API layer for the Zudojs framework.
|
|
5
|
+
*
|
|
6
|
+
* Provides transport-agnostic operation definitions, execution context,
|
|
7
|
+
* interceptors, policies, and result types.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { defineOperation, APIOperationRegistry, APIExecutor } from "@zudojs/api";
|
|
12
|
+
*
|
|
13
|
+
* const getUser = defineOperation({
|
|
14
|
+
* name: "users.get",
|
|
15
|
+
* input: GetUserSchema,
|
|
16
|
+
* output: UserSchema,
|
|
17
|
+
* handler: async (input, context) => {
|
|
18
|
+
* return userService.findById(input.id);
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* const registry = new APIOperationRegistry();
|
|
23
|
+
* registry.register(getUser);
|
|
24
|
+
*
|
|
25
|
+
* const executor = new APIExecutor();
|
|
26
|
+
* const result = await executor.execute(getUser, { id: "123" }, context);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export { apiSuccess, apiFailure, isApiSuccess, isApiFailure, } from "./api/result/apiResult.type.js";
|
|
30
|
+
export { APIError, APIValidationError, APIAuthenticationError, APIAuthorizationError, APINotFoundError, APIConflictError, APIRateLimitError, APITimeoutError, APIUnavailableError, APIInternalError, APIVersionError, APIOperationNotFoundError, APIDuplicateOperationError, APIIdempotencyError, createAPIError, isAPIError, } from "./api/errors/index.js";
|
|
31
|
+
// Constants
|
|
32
|
+
export { DEFAULT_OPERATION_TIMEOUT, MAX_INTERCEPTORS, MAX_POLICIES, } from "./api/constants.js";
|
|
33
|
+
export { createAPIContext, RequestIdContextKey, CorrelationIdContextKey, TenantIdContextKey, UserIdContextKey, StartTimeContextKey, } from "./api/context/context.type.js";
|
|
34
|
+
export { defineOperation } from "./api/operation/operation.type.js";
|
|
35
|
+
// Registry
|
|
36
|
+
export { APIOperationRegistry } from "./api/registry/index.js";
|
|
37
|
+
export { createNoopInterceptor } from "./api/interceptors/interceptor.type.js";
|
|
38
|
+
// Executor
|
|
39
|
+
export { APIExecutor, normalizeAPIError } from "./api/executor/index.js";
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AASH,OAAO,EACL,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,GACb,MAAM,gCAAgC,CAAC;AAKxC,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,mBAAmB,EACnB,cAAc,EACd,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,YAAY;AACZ,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAYvC,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,WAAW;AACX,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAQ/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,WAAW;AACX,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zudojs/api",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Application-facing API layer for Zudojs — operation definitions, execution context, interceptors, policies, and transport-agnostic contracts.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=24.0.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@zudojs/errors": "0.0.1",
|
|
24
|
+
"@zudojs/constants": "0.0.1",
|
|
25
|
+
"@zudojs/types": "0.0.1",
|
|
26
|
+
"@zudojs/schema": "0.0.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^7.0.2",
|
|
30
|
+
"vitest": "^4.1.11"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"zudojs",
|
|
37
|
+
"api",
|
|
38
|
+
"operations",
|
|
39
|
+
"interceptors"
|
|
40
|
+
],
|
|
41
|
+
"homepage": "https://github.com/oyinlola-tech/zudo#readme",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/oyinlola-tech/zudo"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc -p tsconfig.json",
|
|
48
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
49
|
+
"clean": "rm -rf dist",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"test:watch": "vitest"
|
|
52
|
+
}
|
|
53
|
+
}
|