v0-api 0.3.1 → 1.0.16

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 (43) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +13 -3
  3. package/dist/{components-eb0j7zgr.d.ts → components-lojiycjm.d.ts} +165 -284
  4. package/dist/components-lojiycjm.d.ts.map +1 -0
  5. package/dist/components-mcjsnuad.d.ts +894 -0
  6. package/dist/components-mcjsnuad.d.ts.map +1 -0
  7. package/dist/components.cjs +1567 -63
  8. package/dist/components.d.cts +1 -1
  9. package/dist/components.d.mts +1 -1
  10. package/dist/components.mjs +1509 -1
  11. package/dist/effect.cjs +131 -24
  12. package/dist/effect.d.cts +75 -5
  13. package/dist/effect.d.cts.map +1 -1
  14. package/dist/effect.d.mts +75 -5
  15. package/dist/effect.d.mts.map +1 -1
  16. package/dist/effect.mjs +125 -4
  17. package/dist/index.cjs +139 -23
  18. package/dist/index.d.cts +13 -8
  19. package/dist/index.d.cts.map +1 -1
  20. package/dist/index.d.mts +13 -8
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.d.ts +21676 -7155
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.mjs +30 -25
  25. package/dist/{schemas-mph32a3e.cjs → schemas-eef01xgn.cjs} +2004 -590
  26. package/dist/schemas-kunw251r.js +3825 -0
  27. package/dist/schemas.cjs +78 -1
  28. package/dist/schemas.d.cts +13169 -788
  29. package/dist/schemas.d.cts.map +1 -1
  30. package/dist/schemas.d.mts +13169 -788
  31. package/dist/schemas.d.mts.map +1 -1
  32. package/dist/schemas.mjs +1 -1
  33. package/dist/types.cjs +249 -10
  34. package/dist/types.d.cts +2943 -686
  35. package/dist/types.d.cts.map +1 -1
  36. package/dist/types.d.mts +2943 -686
  37. package/dist/types.d.mts.map +1 -1
  38. package/dist/types.mjs +215 -10
  39. package/package.json +18 -15
  40. package/dist/components-da0zh5te.cjs +0 -1497
  41. package/dist/components-eb0j7zgr.d.ts.map +0 -1
  42. package/dist/components-ja14lgg1.js +0 -1435
  43. package/dist/schemas-mkhkzrad.js +0 -2488
package/dist/effect.cjs CHANGED
@@ -1,30 +1,137 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
 
3
- var effect = require('@sferadev/openapi-utils/effect');
4
- var components = require('./components-da0zh5te.cjs');
3
+ var effect = require('effect');
4
+ var components = require('./components.cjs');
5
5
 
6
- const ApiService = effect.createEffectApi(components.operationsByTag);
7
- const effectByPath = effect.createEffectByPath(components.operationsByPath);
6
+ // ============================================================================
7
+ // Error Types
8
+ // ============================================================================
9
+ /**
10
+ * Validation error for client-side input validation failures.
11
+ * Use this for missing required parameters or invalid input formats.
12
+ */ class ValidationError extends effect.Data.TaggedError("ValidationError") {
13
+ get message() {
14
+ return `Validation error for '${this.field}': ${this.reason}`;
15
+ }
16
+ }
17
+ /**
18
+ * API error with status code and error payload.
19
+ * Uses Effect's Data.TaggedError for pattern matching support.
20
+ */ class ApiError extends effect.Data.TaggedError("ApiError") {
21
+ get message() {
22
+ const message = errorMessage(this.error);
23
+ return message ? `API error ${this.status}: ${message}` : `API Error: ${this.status}`;
24
+ }
25
+ }
26
+ // Error bodies vary by API: `{ message }`, `{ error }`, `{ error: { message } }`, `{ errors: [{ message }] }` or text.
27
+ function errorMessage(value) {
28
+ if (isRecord(value) && "payload" in value) {
29
+ const fromPayload = errorMessage(value.payload);
30
+ if (fromPayload) return fromPayload;
31
+ }
32
+ if (typeof value === "string") return value.trim() || undefined;
33
+ if (!isRecord(value)) return undefined;
34
+ if (typeof value.message === "string" && value.message) return value.message;
35
+ if ("error" in value) {
36
+ const fromError = errorMessage(value.error);
37
+ if (fromError) return fromError;
38
+ }
39
+ if (Array.isArray(value.errors)) return errorMessage(value.errors[0]);
40
+ return undefined;
41
+ }
42
+ function isRecord(value) {
43
+ return typeof value === "object" && value !== null && !Array.isArray(value);
44
+ }
45
+ /**
46
+ * Network error for fetch failures (timeouts, DNS errors, etc).
47
+ */ class NetworkError extends effect.Data.TaggedError("NetworkError") {
48
+ get message() {
49
+ if (this.cause instanceof Error) {
50
+ return `Network error: ${this.cause.message}`;
51
+ }
52
+ if (isRecord(this.cause) && typeof this.cause.message === "string" && this.cause.message) {
53
+ return `Network error: ${this.cause.message}`;
54
+ }
55
+ return "Network error";
56
+ }
57
+ }
58
+ class ApiConfig extends effect.Context.Service()("ApiConfig") {
59
+ }
60
+ /**
61
+ * Create a Layer providing ApiConfig values.
62
+ */ const makeApiLayer = (config)=>effect.Layer.succeed(ApiConfig, config);
63
+ // ============================================================================
64
+ // Error Conversion
65
+ // ============================================================================
66
+ function convertError(error) {
67
+ if (error instanceof Error && error.message.includes("Missing required path parameter")) {
68
+ const field = error.message.replace("Missing required path parameter: ", "");
69
+ return new ValidationError({
70
+ field,
71
+ reason: "Missing required path parameter"
72
+ });
73
+ }
74
+ if (typeof error === "object" && error !== null && "status" in error) {
75
+ return new ApiError({
76
+ status: error.status,
77
+ error
78
+ });
79
+ }
80
+ return new NetworkError({
81
+ cause: error
82
+ });
83
+ }
84
+ // ============================================================================
85
+ // Proxy Factories
86
+ // ============================================================================
87
+ function ownValue(target, key) {
88
+ return Object.hasOwn(target, key) ? target[key] : undefined;
89
+ }
90
+ function toEffect(op) {
91
+ return (params)=>effect.Effect.gen(function*() {
92
+ const config = yield* ApiConfig;
93
+ return yield* effect.Effect.tryPromise({
94
+ try: (signal)=>op({
95
+ ...params ?? {},
96
+ config: {
97
+ ...config,
98
+ signal
99
+ }
100
+ }),
101
+ catch: convertError
102
+ });
103
+ });
104
+ }
105
+ function createEffectApi(operationsByTag) {
106
+ return new Proxy({}, {
107
+ get: (_, tag)=>{
108
+ const tagOps = ownValue(operationsByTag, tag);
109
+ if (!tagOps) return undefined;
110
+ return new Proxy({}, {
111
+ get: (_, operation)=>{
112
+ const op = ownValue(tagOps, operation);
113
+ return op ? toEffect(op) : undefined;
114
+ }
115
+ });
116
+ }
117
+ });
118
+ }
119
+ function createEffectByPath(operationsByPath) {
120
+ return new Proxy({}, {
121
+ get: (_, endpoint)=>{
122
+ const op = ownValue(operationsByPath, endpoint);
123
+ return op ? toEffect(op) : undefined;
124
+ }
125
+ });
126
+ }
8
127
 
9
- Object.defineProperty(exports, "ApiConfig", {
10
- enumerable: true,
11
- get: function () { return effect.ApiConfig; }
12
- });
13
- Object.defineProperty(exports, "ApiError", {
14
- enumerable: true,
15
- get: function () { return effect.ApiError; }
16
- });
17
- Object.defineProperty(exports, "NetworkError", {
18
- enumerable: true,
19
- get: function () { return effect.NetworkError; }
20
- });
21
- Object.defineProperty(exports, "ValidationError", {
22
- enumerable: true,
23
- get: function () { return effect.ValidationError; }
24
- });
25
- Object.defineProperty(exports, "makeApiLayer", {
26
- enumerable: true,
27
- get: function () { return effect.makeApiLayer; }
28
- });
128
+ const ApiService = createEffectApi(components.operationsByTag);
129
+ const effectByPath = createEffectByPath(components.operationsByPath);
130
+
131
+ exports.ApiConfig = ApiConfig;
132
+ exports.ApiError = ApiError;
29
133
  exports.ApiService = ApiService;
134
+ exports.NetworkError = NetworkError;
135
+ exports.ValidationError = ValidationError;
30
136
  exports.effectByPath = effectByPath;
137
+ exports.makeApiLayer = makeApiLayer;
package/dist/effect.d.cts CHANGED
@@ -1,8 +1,77 @@
1
- import * as _sferadev_openapi_utils_effect from '@sferadev/openapi-utils/effect';
2
- export { ApiConfig, ApiError, EffectApi, NetworkError, ValidationError, makeApiLayer } from '@sferadev/openapi-utils/effect';
1
+ import * as effect_Cause from 'effect/Cause';
2
+ import * as effect_Types from 'effect/Types';
3
+ import { Context, Effect, Layer } from 'effect';
3
4
  import { chatsCreate, chatsFind, chatsInit, chatsDelete, chatsGetById, chatsUpdate, chatsFavorite, chatsFork, chatsFindMessages, chatsSendMessage, chatsGetMessage, chatsFindVersions, chatsGetVersion, chatsUpdateVersion, chatsDownloadVersion, chatsDeleteVersionFiles, chatsResume, chatsStop, chatsResolveTask, chatsRestore, projectsGetByChatId, projectsFind, projectsCreate, projectsGetById, projectsUpdate, projectsDelete, projectsAssign, projectsFindEnvVars, projectsCreateEnvVars, projectsUpdateEnvVars, projectsDeleteEnvVars, projectsGetEnvVar, deploymentsFind, deploymentsCreate, deploymentsGetById, deploymentsDelete, deploymentsFindLogs, deploymentsFindErrors, hooksFind, hooksCreate, hooksGetById, hooksUpdate, hooksDelete, integrationsVercelProjectsFind, integrationsVercelProjectsCreate, rateLimitsFind, userGet, userGetBilling, userGetPlan, userGetScopes, reportsGetUsage, reportsGetAIUsage, reportsGetUserActivity, mcpServersFind, mcpServersCreate, mcpServersGetById, mcpServersUpdate, mcpServersDelete, mcpServersCreateOAuthAuthorizationUrl } from './components.cjs';
4
5
 
5
- declare const ApiService: _sferadev_openapi_utils_effect.EffectApi<{
6
+ declare const ValidationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & {
7
+ readonly _tag: "ValidationError";
8
+ } & Readonly<A>;
9
+ /**
10
+ * Validation error for client-side input validation failures.
11
+ * Use this for missing required parameters or invalid input formats.
12
+ */
13
+ declare class ValidationError extends ValidationError_base<{
14
+ readonly field: string;
15
+ readonly reason: string;
16
+ }> {
17
+ get message(): string;
18
+ }
19
+ declare const ApiError_base: new <A extends Record<string, any> = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & {
20
+ readonly _tag: "ApiError";
21
+ } & Readonly<A>;
22
+ /**
23
+ * API error with status code and error payload.
24
+ * Uses Effect's Data.TaggedError for pattern matching support.
25
+ */
26
+ declare class ApiError extends ApiError_base<{
27
+ readonly status: number;
28
+ readonly error: unknown;
29
+ }> {
30
+ get message(): string;
31
+ }
32
+ declare const NetworkError_base: new <A extends Record<string, any> = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & {
33
+ readonly _tag: "NetworkError";
34
+ } & Readonly<A>;
35
+ /**
36
+ * Network error for fetch failures (timeouts, DNS errors, etc).
37
+ */
38
+ declare class NetworkError extends NetworkError_base<{
39
+ readonly cause: unknown;
40
+ }> {
41
+ get message(): string;
42
+ }
43
+ /**
44
+ * Effect service key for API configuration.
45
+ * Used by the proxy-based Effect API to inject config into operations.
46
+ */
47
+ type ApiConfigShape = {
48
+ token?: string;
49
+ baseUrl?: string;
50
+ fetchImpl?: (url: string, init?: any) => Promise<any>;
51
+ headers?: Record<string, string>;
52
+ };
53
+ declare const ApiConfig_base: Context.ServiceClass<ApiConfig, "ApiConfig", ApiConfigShape>;
54
+ declare class ApiConfig extends ApiConfig_base {
55
+ }
56
+ /**
57
+ * Create a Layer providing ApiConfig values.
58
+ */
59
+ declare const makeApiLayer: (config: ApiConfigShape) => Layer.Layer<ApiConfig>;
60
+
61
+ type RequiredKeys<T> = {
62
+ [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
63
+ }[keyof T];
64
+ type EffectOperation<Op> = Op extends (params: infer P) => Promise<infer R> ? Omit<NonNullable<P>, "config"> extends infer Params ? [RequiredKeys<Params>] extends [never] ? (params?: Params) => Effect.Effect<R, ApiError | ValidationError | NetworkError, ApiConfig> : (params: Params) => Effect.Effect<R, ApiError | ValidationError | NetworkError, ApiConfig> : never : never;
65
+ type EffectApi<Tags extends Record<string, Record<string, (...args: any[]) => any>>> = {
66
+ [Tag in keyof Tags]: {
67
+ [Op in keyof Tags[Tag]]: EffectOperation<Tags[Tag][Op]>;
68
+ };
69
+ };
70
+ type EffectByPath<Paths extends Record<string, (...args: any[]) => any>> = {
71
+ [K in keyof Paths]: EffectOperation<Paths[K]>;
72
+ };
73
+
74
+ declare const ApiService: EffectApi<{
6
75
  chats: {
7
76
  chatsCreate: typeof chatsCreate;
8
77
  chatsFind: typeof chatsFind;
@@ -81,7 +150,7 @@ declare const ApiService: _sferadev_openapi_utils_effect.EffectApi<{
81
150
  mcpServersCreateOAuthAuthorizationUrl: typeof mcpServersCreateOAuthAuthorizationUrl;
82
151
  };
83
152
  }>;
84
- declare const effectByPath: _sferadev_openapi_utils_effect.EffectByPath<{
153
+ declare const effectByPath: EffectByPath<{
85
154
  "POST /chats": typeof chatsCreate;
86
155
  "GET /chats": typeof chatsFind;
87
156
  "POST /chats/init": typeof chatsInit;
@@ -143,5 +212,6 @@ declare const effectByPath: _sferadev_openapi_utils_effect.EffectByPath<{
143
212
  "POST /mcp-servers/{mcpServerId}/oauth/authorize": typeof mcpServersCreateOAuthAuthorizationUrl;
144
213
  }>;
145
214
 
146
- export { ApiService, effectByPath };
215
+ export { ApiConfig, ApiError, ApiService, NetworkError, ValidationError, effectByPath, makeApiLayer };
216
+ export type { EffectApi };
147
217
  //# sourceMappingURL=effect.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"effect.d.cts","sources":["../src/effect.ts"],"mappings":";;;;AAEA,cAAc,UAAU,EAAE,8BAA8B,CAAC,SAAS;AAClE;AACA,4BAA4BA,WAAwB;AACpD,0BAA0BC,SAAsB;AAChD,0BAA0BC,SAAsB;AAChD,4BAA4BC,WAAwB;AACpD,6BAA6BC,YAAyB;AACtD,4BAA4BC,WAAwB;AACpD,8BAA8BC,aAA0B;AACxD,0BAA0BC,SAAsB;AAChD,kCAAkCC,iBAA8B;AAChE,iCAAiCC,gBAA6B;AAC9D,gCAAgCC,eAA4B;AAC5D,kCAAkCC,iBAA8B;AAChE,gCAAgCC,eAA4B;AAC5D,mCAAmCC,kBAA+B;AAClE,qCAAqCC,oBAAiC;AACtE,wCAAwCC,uBAAoC;AAC5E,4BAA4BC,WAAwB;AACpD,0BAA0BC,SAAsB;AAChD,iCAAiCC,gBAA6B;AAC9D,6BAA6BC,YAAyB;AACtD;AACA;AACA,oCAAoCC,mBAAgC;AACpE,6BAA6BC,YAAyB;AACtD,+BAA+BC,cAA2B;AAC1D,gCAAgCC,eAA4B;AAC5D,+BAA+BC,cAA2B;AAC1D,+BAA+BC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A8B;AACzE,uDAAuDC,eAA4B;AACnF,yDAAyDC,kBAA+B;AACxF,gEAAgEC,oBAAiC;AACjG,qEAAqEC,uBAAoC;AACzG,+DAA+DC,WAAwB;AACvF,6DAA6DC,SAAsB;AACnF,iDAAiDC,gBAA6B;AAC9E,+BAA+Bc,eAA4B;AAC3D,gCAAgCC,iBAA8B;AAC9D,8CAA8CC,kBAA+B;AAC7E,iDAAiDC,iBAA8B;AAC/E,mDAAmDC,mBAAgC;AACnF,qDAAqDC,qBAAkC;AACvF,yBAAyBC,SAAsB;AAC/C,0BAA0BC,WAAwB;AAClD,kCAAkCC,YAAyB;AAC3D,oCAAoCC,WAAwB;AAC5D,qCAAqCC,WAAwB;AAC7D,gDAAgDC,8BAA2C;AAC3F,iDAAiDC,gCAA6C;AAC9F,4BAA4BvB,YAAyB;AACrD,6BAA6BC,cAA2B;AACxD,wCAAwCC,eAA4B;AACpE,0CAA0CC,cAA2B;AACrE,2CAA2CC,cAA2B;AACtE,gDAAgDC,cAA2B;AAC3E,iDAAiDC,mBAAgC;AACjF,kDAAkDC,qBAAkC;AACpF,mDAAmDC,qBAAkC;AACrF,yDAAyDC,qBAAkC;AAC3F,yEAAyEC,iBAA8B;AACvG,+BAA+Bc,cAA2B;AAC1D,wBAAwBC,OAAoB;AAC5C,gCAAgCC,cAA2B;AAC3D,6BAA6BC,WAAwB;AACrD,+BAA+BC,aAA0B;AACzD,gEAAgE9B,YAAyB;AACzF,iCAAiC+B,eAA4B;AAC7D,oCAAoCC,iBAA8B;AAClE,yCAAyCC,sBAAmC;AAC5E,+BAA+BC,cAA2B;AAC1D,gCAAgCC,gBAA6B;AAC7D,6CAA6CC,iBAA8B;AAC3E,+CAA+CC,gBAA6B;AAC5E,gDAAgDC,gBAA6B;AAC7E,8DAA8DC,qCAAkD;AAChH","names":["__components.chatsCreate","__components.chatsFind","__components.chatsInit","__components.chatsDelete","__components.chatsGetById","__components.chatsUpdate","__components.chatsFavorite","__components.chatsFork","__components.chatsFindMessages","__components.chatsSendMessage","__components.chatsGetMessage","__components.chatsFindVersions","__components.chatsGetVersion","__components.chatsUpdateVersion","__components.chatsDownloadVersion","__components.chatsDeleteVersionFiles","__components.chatsResume","__components.chatsStop","__components.chatsResolveTask","__components.chatsRestore","__components.projectsGetByChatId","__components.projectsFind","__components.projectsCreate","__components.projectsGetById","__components.projectsUpdate","__components.projectsDelete","__components.projectsAssign","__components.projectsFindEnvVars","__components.projectsCreateEnvVars","__components.projectsUpdateEnvVars","__components.projectsDeleteEnvVars","__components.projectsGetEnvVar","__components.deploymentsFind","__components.deploymentsCreate","__components.deploymentsGetById","__components.deploymentsDelete","__components.deploymentsFindLogs","__components.deploymentsFindErrors","__components.hooksFind","__components.hooksCreate","__components.hooksGetById","__components.hooksUpdate","__components.hooksDelete","__components.integrationsVercelProjectsFind","__components.integrationsVercelProjectsCreate","__components.rateLimitsFind","__components.userGet","__components.userGetBilling","__components.userGetPlan","__components.userGetScopes","__components.reportsGetUsage","__components.reportsGetAIUsage","__components.reportsGetUserActivity","__components.mcpServersFind","__components.mcpServersCreate","__components.mcpServersGetById","__components.mcpServersUpdate","__components.mcpServersDelete","__components.mcpServersCreateOAuthAuthorizationUrl"]}
1
+ {"version":3,"file":"effect.d.cts","sources":["../../openapi-utils/dist/effect/index.d.mts","../src/effect.ts"],"mappings":";;;;;AAIA,cAAc,oBAAoB,iBAAiB,MAAM,0BAA0B,YAAY,CAAC,WAAW,yEAAyE,YAAY,CAAC,cAAc;AAC/M;AACA,IAAI,QAAQ;AACZ;AACA;AACA;AACA;AACA,cAAc,eAAe,SAAS,oBAAoB;AAC1D;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa,iBAAiB,MAAM,0BAA0B,YAAY,CAAC,WAAW,yEAAyE,YAAY,CAAC,cAAc;AACxM;AACA,IAAI,QAAQ;AACZ;AACA;AACA;AACA;AACA,cAAc,QAAQ,SAAS,aAAa;AAC5C;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB,iBAAi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C1D,gCAAgCC,gBAA6B;AAC7D,6CAA6CC,iBAA8B;AAC3E,+CAA+CC,gBAA6B;AAC5E,gDAAgDC,gBAA6B;AAC7E,8DAA8DC,qCAAkD;AAChH","names":["_sferadev_openapi_utils_effect.EffectApi","__components.chatsCreate","__components.chatsFind","__components.chatsInit","__components.chatsDelete","__components.chatsGetById","__components.chatsUpdate","__components.chatsFavorite","__components.chatsFork","__components.chatsFindMessages","__components.chatsSendMessage","__components.chatsGetMessage","__components.chatsFindVersions","__components.chatsGetVersion","__components.chatsUpdateVersion","__components.chatsDownloadVersion","__components.chatsDeleteVersionFiles","__components.chatsResume","__components.chatsStop","__components.chatsResolveTask","__components.chatsRestore","__components.projectsGetByChatId","__components.projectsFind","__components.projectsCreate","__components.projectsGetById","__components.projectsUpdate","__components.projectsDelete","__components.projectsAssign","__components.projectsFindEnvVars","__components.projectsCreateEnvVars","__components.projectsUpdateEnvVars","__components.projectsDeleteEnvVars","__components.projectsGetEnvVar","__components.deploymentsFind","__components.deploymentsCreate","__components.deploymentsGetById","__components.deploymentsDelete","__components.deploymentsFindLogs","__components.deploymentsFindErrors","__components.hooksFind","__components.hooksCreate","__components.hooksGetById","__components.hooksUpdate","__components.hooksDelete","__components.integrationsVercelProjectsFind","__components.integrationsVercelProjectsCreate","__components.rateLimitsFind","__components.userGet","__components.userGetBilling","__components.userGetPlan","__components.userGetScopes","__components.reportsGetUsage","__components.reportsGetAIUsage","__components.reportsGetUserActivity","__components.mcpServersFind","__components.mcpServersCreate","__components.mcpServersGetById","__components.mcpServersUpdate","__components.mcpServersDelete","__components.mcpServersCreateOAuthAuthorizationUrl","_sferadev_openapi_utils_effect.EffectByPath"]}
package/dist/effect.d.mts CHANGED
@@ -1,8 +1,77 @@
1
- import * as _sferadev_openapi_utils_effect from '@sferadev/openapi-utils/effect';
2
- export { ApiConfig, ApiError, EffectApi, NetworkError, ValidationError, makeApiLayer } from '@sferadev/openapi-utils/effect';
1
+ import * as effect_Cause from 'effect/Cause';
2
+ import * as effect_Types from 'effect/Types';
3
+ import { Context, Effect, Layer } from 'effect';
3
4
  import { chatsCreate, chatsFind, chatsInit, chatsDelete, chatsGetById, chatsUpdate, chatsFavorite, chatsFork, chatsFindMessages, chatsSendMessage, chatsGetMessage, chatsFindVersions, chatsGetVersion, chatsUpdateVersion, chatsDownloadVersion, chatsDeleteVersionFiles, chatsResume, chatsStop, chatsResolveTask, chatsRestore, projectsGetByChatId, projectsFind, projectsCreate, projectsGetById, projectsUpdate, projectsDelete, projectsAssign, projectsFindEnvVars, projectsCreateEnvVars, projectsUpdateEnvVars, projectsDeleteEnvVars, projectsGetEnvVar, deploymentsFind, deploymentsCreate, deploymentsGetById, deploymentsDelete, deploymentsFindLogs, deploymentsFindErrors, hooksFind, hooksCreate, hooksGetById, hooksUpdate, hooksDelete, integrationsVercelProjectsFind, integrationsVercelProjectsCreate, rateLimitsFind, userGet, userGetBilling, userGetPlan, userGetScopes, reportsGetUsage, reportsGetAIUsage, reportsGetUserActivity, mcpServersFind, mcpServersCreate, mcpServersGetById, mcpServersUpdate, mcpServersDelete, mcpServersCreateOAuthAuthorizationUrl } from './components.mjs';
4
5
 
5
- declare const ApiService: _sferadev_openapi_utils_effect.EffectApi<{
6
+ declare const ValidationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & {
7
+ readonly _tag: "ValidationError";
8
+ } & Readonly<A>;
9
+ /**
10
+ * Validation error for client-side input validation failures.
11
+ * Use this for missing required parameters or invalid input formats.
12
+ */
13
+ declare class ValidationError extends ValidationError_base<{
14
+ readonly field: string;
15
+ readonly reason: string;
16
+ }> {
17
+ get message(): string;
18
+ }
19
+ declare const ApiError_base: new <A extends Record<string, any> = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & {
20
+ readonly _tag: "ApiError";
21
+ } & Readonly<A>;
22
+ /**
23
+ * API error with status code and error payload.
24
+ * Uses Effect's Data.TaggedError for pattern matching support.
25
+ */
26
+ declare class ApiError extends ApiError_base<{
27
+ readonly status: number;
28
+ readonly error: unknown;
29
+ }> {
30
+ get message(): string;
31
+ }
32
+ declare const NetworkError_base: new <A extends Record<string, any> = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & {
33
+ readonly _tag: "NetworkError";
34
+ } & Readonly<A>;
35
+ /**
36
+ * Network error for fetch failures (timeouts, DNS errors, etc).
37
+ */
38
+ declare class NetworkError extends NetworkError_base<{
39
+ readonly cause: unknown;
40
+ }> {
41
+ get message(): string;
42
+ }
43
+ /**
44
+ * Effect service key for API configuration.
45
+ * Used by the proxy-based Effect API to inject config into operations.
46
+ */
47
+ type ApiConfigShape = {
48
+ token?: string;
49
+ baseUrl?: string;
50
+ fetchImpl?: (url: string, init?: any) => Promise<any>;
51
+ headers?: Record<string, string>;
52
+ };
53
+ declare const ApiConfig_base: Context.ServiceClass<ApiConfig, "ApiConfig", ApiConfigShape>;
54
+ declare class ApiConfig extends ApiConfig_base {
55
+ }
56
+ /**
57
+ * Create a Layer providing ApiConfig values.
58
+ */
59
+ declare const makeApiLayer: (config: ApiConfigShape) => Layer.Layer<ApiConfig>;
60
+
61
+ type RequiredKeys<T> = {
62
+ [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
63
+ }[keyof T];
64
+ type EffectOperation<Op> = Op extends (params: infer P) => Promise<infer R> ? Omit<NonNullable<P>, "config"> extends infer Params ? [RequiredKeys<Params>] extends [never] ? (params?: Params) => Effect.Effect<R, ApiError | ValidationError | NetworkError, ApiConfig> : (params: Params) => Effect.Effect<R, ApiError | ValidationError | NetworkError, ApiConfig> : never : never;
65
+ type EffectApi<Tags extends Record<string, Record<string, (...args: any[]) => any>>> = {
66
+ [Tag in keyof Tags]: {
67
+ [Op in keyof Tags[Tag]]: EffectOperation<Tags[Tag][Op]>;
68
+ };
69
+ };
70
+ type EffectByPath<Paths extends Record<string, (...args: any[]) => any>> = {
71
+ [K in keyof Paths]: EffectOperation<Paths[K]>;
72
+ };
73
+
74
+ declare const ApiService: EffectApi<{
6
75
  chats: {
7
76
  chatsCreate: typeof chatsCreate;
8
77
  chatsFind: typeof chatsFind;
@@ -81,7 +150,7 @@ declare const ApiService: _sferadev_openapi_utils_effect.EffectApi<{
81
150
  mcpServersCreateOAuthAuthorizationUrl: typeof mcpServersCreateOAuthAuthorizationUrl;
82
151
  };
83
152
  }>;
84
- declare const effectByPath: _sferadev_openapi_utils_effect.EffectByPath<{
153
+ declare const effectByPath: EffectByPath<{
85
154
  "POST /chats": typeof chatsCreate;
86
155
  "GET /chats": typeof chatsFind;
87
156
  "POST /chats/init": typeof chatsInit;
@@ -143,5 +212,6 @@ declare const effectByPath: _sferadev_openapi_utils_effect.EffectByPath<{
143
212
  "POST /mcp-servers/{mcpServerId}/oauth/authorize": typeof mcpServersCreateOAuthAuthorizationUrl;
144
213
  }>;
145
214
 
146
- export { ApiService, effectByPath };
215
+ export { ApiConfig, ApiError, ApiService, NetworkError, ValidationError, effectByPath, makeApiLayer };
216
+ export type { EffectApi };
147
217
  //# sourceMappingURL=effect.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"effect.d.mts","sources":["../src/effect.ts"],"mappings":";;;;AAEA,cAAc,UAAU,EAAE,8BAA8B,CAAC,SAAS;AAClE;AACA,4BAA4BA,WAAwB;AACpD,0BAA0BC,SAAsB;AAChD,0BAA0BC,SAAsB;AAChD,4BAA4BC,WAAwB;AACpD,6BAA6BC,YAAyB;AACtD,4BAA4BC,WAAwB;AACpD,8BAA8BC,aAA0B;AACxD,0BAA0BC,SAAsB;AAChD,kCAAkCC,iBAA8B;AAChE,iCAAiCC,gBAA6B;AAC9D,gCAAgCC,eAA4B;AAC5D,kCAAkCC,iBAA8B;AAChE,gCAAgCC,eAA4B;AAC5D,mCAAmCC,kBA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B;AAClE,yCAAyCC,sBAAmC;AAC5E,+BAA+BC,cAA2B;AAC1D,gCAAgCC,gBAA6B;AAC7D,6CAA6CC,iBAA8B;AAC3E,+CAA+CC,gBAA6B;AAC5E,gDAAgDC,gBAA6B;AAC7E,8DAA8DC,qCAAkD;AAChH","names":["__components.chatsCreate","__components.chatsFind","__components.chatsInit","__components.chatsDelete","__components.chatsGetById","__components.chatsUpdate","__components.chatsFavorite","__components.chatsFork","__components.chatsFindMessages","__components.chatsSendMessage","__components.chatsGetMessage","__components.chatsFindVersions","__components.chatsGetVersion","__components.chatsUpdateVersion","__components.chatsDownloadVersion","__components.chatsDeleteVersionFiles","__components.chatsResume","__components.chatsStop","__components.chatsResolveTask","__components.chatsRestore","__components.projectsGetByChatId","__components.projectsFind","__components.projectsCreate","__components.projectsGetById","__components.projectsUpdate","__components.projectsDelete","__components.projectsAssign","__components.projectsFindEnvVars","__components.projectsCreateEnvVars","__components.projectsUpdateEnvVars","__components.projectsDeleteEnvVars","__components.projectsGetEnvVar","__components.deploymentsFind","__components.deploymentsCreate","__components.deploymentsGetById","__components.deploymentsDelete","__components.deploymentsFindLogs","__components.deploymentsFindErrors","__components.hooksFind","__components.hooksCreate","__components.hooksGetById","__components.hooksUpdate","__components.hooksDelete","__components.integrationsVercelProjectsFind","__components.integrationsVercelProjectsCreate","__components.rateLimitsFind","__components.userGet","__components.userGetBilling","__components.userGetPlan","__components.userGetScopes","__components.reportsGetUsage","__components.reportsGetAIUsage","__components.reportsGetUserActivity","__components.mcpServersFind","__components.mcpServersCreate","__components.mcpServersGetById","__components.mcpServersUpdate","__components.mcpServersDelete","__components.mcpServersCreateOAuthAuthorizationUrl"]}
1
+ {"version":3,"file":"effect.d.mts","sources":["../../openapi-utils/dist/effect/index.d.mts","../src/effect.ts"],"mappings":";;;;;AAIA,cAAc,oBAAoB,iBAAiB,MAAM,0BAA0B,YAAY,CAAC,WAAW,yEAAyE,YAAY,CAAC,cAAc;AAC/M;AACA,IAAI,QAAQ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ACrF,yDAAyDC,qBAAkC;AAC3F,yEAAyEC,iBAA8B;AACvG,+BAA+Bc,cAA2B;AAC1D,wBAAwBC,OAAoB;AAC5C,gCAAgCC,cAA2B;AAC3D,6BAA6BC,WAAwB;AACrD,+BAA+BC,aAA0B;AACzD,gEAAgE9B,YAAyB;AACzF,iCAAiC+B,eAA4B;AAC7D,oCAAoCC,iBAA8B;AAClE,yCAAyCC,sBAAmC;AAC5E,+BAA+BC,cAA2B;AAC1D,gCAAgCC,gBAA6B;AAC7D,6CAA6CC,iBAA8B;AAC3E,+CAA+CC,gBAA6B;AAC5E,gDAAgDC,gBAA6B;AAC7E,8DAA8DC,qCAAkD;AAChH","names":["_sferadev_openapi_utils_effect.EffectApi","__components.chatsCreate","__components.chatsFind","__components.chatsInit","__components.chatsDelete","__components.chatsGetById","__components.chatsUpdate","__components.chatsFavorite","__components.chatsFork","__components.chatsFindMessages","__components.chatsSendMessage","__components.chatsGetMessage","__components.chatsFindVersions","__components.chatsGetVersion","__components.chatsUpdateVersion","__components.chatsDownloadVersion","__components.chatsDeleteVersionFiles","__components.chatsResume","__components.chatsStop","__components.chatsResolveTask","__components.chatsRestore","__components.projectsGetByChatId","__components.projectsFind","__components.projectsCreate","__components.projectsGetById","__components.projectsUpdate","__components.projectsDelete","__components.projectsAssign","__components.projectsFindEnvVars","__components.projectsCreateEnvVars","__components.projectsUpdateEnvVars","__components.projectsDeleteEnvVars","__components.projectsGetEnvVar","__components.deploymentsFind","__components.deploymentsCreate","__components.deploymentsGetById","__components.deploymentsDelete","__components.deploymentsFindLogs","__components.deploymentsFindErrors","__components.hooksFind","__components.hooksCreate","__components.hooksGetById","__components.hooksUpdate","__components.hooksDelete","__components.integrationsVercelProjectsFind","__components.integrationsVercelProjectsCreate","__components.rateLimitsFind","__components.userGet","__components.userGetBilling","__components.userGetPlan","__components.userGetScopes","__components.reportsGetUsage","__components.reportsGetAIUsage","__components.reportsGetUserActivity","__components.mcpServersFind","__components.mcpServersCreate","__components.mcpServersGetById","__components.mcpServersUpdate","__components.mcpServersDelete","__components.mcpServersCreateOAuthAuthorizationUrl","_sferadev_openapi_utils_effect.EffectByPath"]}
package/dist/effect.mjs CHANGED
@@ -1,8 +1,129 @@
1
- import { createEffectApi, createEffectByPath } from '@sferadev/openapi-utils/effect';
2
- export { ApiConfig, ApiError, NetworkError, ValidationError, makeApiLayer } from '@sferadev/openapi-utils/effect';
3
- import { o as operationsByTag, a as operationsByPath } from './components-ja14lgg1.js';
1
+ import { Data, Context, Effect, Layer } from 'effect';
2
+ import { operationsByPath, operationsByTag } from './components.mjs';
3
+
4
+ // ============================================================================
5
+ // Error Types
6
+ // ============================================================================
7
+ /**
8
+ * Validation error for client-side input validation failures.
9
+ * Use this for missing required parameters or invalid input formats.
10
+ */ class ValidationError extends Data.TaggedError("ValidationError") {
11
+ get message() {
12
+ return `Validation error for '${this.field}': ${this.reason}`;
13
+ }
14
+ }
15
+ /**
16
+ * API error with status code and error payload.
17
+ * Uses Effect's Data.TaggedError for pattern matching support.
18
+ */ class ApiError extends Data.TaggedError("ApiError") {
19
+ get message() {
20
+ const message = errorMessage(this.error);
21
+ return message ? `API error ${this.status}: ${message}` : `API Error: ${this.status}`;
22
+ }
23
+ }
24
+ // Error bodies vary by API: `{ message }`, `{ error }`, `{ error: { message } }`, `{ errors: [{ message }] }` or text.
25
+ function errorMessage(value) {
26
+ if (isRecord(value) && "payload" in value) {
27
+ const fromPayload = errorMessage(value.payload);
28
+ if (fromPayload) return fromPayload;
29
+ }
30
+ if (typeof value === "string") return value.trim() || undefined;
31
+ if (!isRecord(value)) return undefined;
32
+ if (typeof value.message === "string" && value.message) return value.message;
33
+ if ("error" in value) {
34
+ const fromError = errorMessage(value.error);
35
+ if (fromError) return fromError;
36
+ }
37
+ if (Array.isArray(value.errors)) return errorMessage(value.errors[0]);
38
+ return undefined;
39
+ }
40
+ function isRecord(value) {
41
+ return typeof value === "object" && value !== null && !Array.isArray(value);
42
+ }
43
+ /**
44
+ * Network error for fetch failures (timeouts, DNS errors, etc).
45
+ */ class NetworkError extends Data.TaggedError("NetworkError") {
46
+ get message() {
47
+ if (this.cause instanceof Error) {
48
+ return `Network error: ${this.cause.message}`;
49
+ }
50
+ if (isRecord(this.cause) && typeof this.cause.message === "string" && this.cause.message) {
51
+ return `Network error: ${this.cause.message}`;
52
+ }
53
+ return "Network error";
54
+ }
55
+ }
56
+ class ApiConfig extends Context.Service()("ApiConfig") {
57
+ }
58
+ /**
59
+ * Create a Layer providing ApiConfig values.
60
+ */ const makeApiLayer = (config)=>Layer.succeed(ApiConfig, config);
61
+ // ============================================================================
62
+ // Error Conversion
63
+ // ============================================================================
64
+ function convertError(error) {
65
+ if (error instanceof Error && error.message.includes("Missing required path parameter")) {
66
+ const field = error.message.replace("Missing required path parameter: ", "");
67
+ return new ValidationError({
68
+ field,
69
+ reason: "Missing required path parameter"
70
+ });
71
+ }
72
+ if (typeof error === "object" && error !== null && "status" in error) {
73
+ return new ApiError({
74
+ status: error.status,
75
+ error
76
+ });
77
+ }
78
+ return new NetworkError({
79
+ cause: error
80
+ });
81
+ }
82
+ // ============================================================================
83
+ // Proxy Factories
84
+ // ============================================================================
85
+ function ownValue(target, key) {
86
+ return Object.hasOwn(target, key) ? target[key] : undefined;
87
+ }
88
+ function toEffect(op) {
89
+ return (params)=>Effect.gen(function*() {
90
+ const config = yield* ApiConfig;
91
+ return yield* Effect.tryPromise({
92
+ try: (signal)=>op({
93
+ ...params ?? {},
94
+ config: {
95
+ ...config,
96
+ signal
97
+ }
98
+ }),
99
+ catch: convertError
100
+ });
101
+ });
102
+ }
103
+ function createEffectApi(operationsByTag) {
104
+ return new Proxy({}, {
105
+ get: (_, tag)=>{
106
+ const tagOps = ownValue(operationsByTag, tag);
107
+ if (!tagOps) return undefined;
108
+ return new Proxy({}, {
109
+ get: (_, operation)=>{
110
+ const op = ownValue(tagOps, operation);
111
+ return op ? toEffect(op) : undefined;
112
+ }
113
+ });
114
+ }
115
+ });
116
+ }
117
+ function createEffectByPath(operationsByPath) {
118
+ return new Proxy({}, {
119
+ get: (_, endpoint)=>{
120
+ const op = ownValue(operationsByPath, endpoint);
121
+ return op ? toEffect(op) : undefined;
122
+ }
123
+ });
124
+ }
4
125
 
5
126
  const ApiService = createEffectApi(operationsByTag);
6
127
  const effectByPath = createEffectByPath(operationsByPath);
7
128
 
8
- export { ApiService, effectByPath };
129
+ export { ApiConfig, ApiError, ApiService, NetworkError, ValidationError, effectByPath, makeApiLayer };