@kosdev-code/kos-ui-sdk 0.1.0-next.867 → 0.1.0-next.871

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.
@@ -8,14 +8,20 @@ import { paths } from './openapi';
8
8
  export type Api = paths;
9
9
  export type ApiPath = keyof paths;
10
10
  export type ValidPaths = PathsByMethod<paths>;
11
+ /**
12
+ * Methods a response type can be derived for — the lowercase subset of
13
+ * HttpMethod. The uppercase spellings HttpMethod also permits do not match the
14
+ * keys of an OpenAPI `paths` object, so they would silently yield `unknown`.
15
+ */
16
+ export type SupportedMethod = "get" | "post" | "put" | "delete" | "patch";
11
17
  /**
12
18
  * Get client response type for kos API
13
19
  */
14
- export type ApiResponse<Path extends ApiPath, Method extends "get" | "post" | "put" | "delete" = "get"> = ClientResponse<paths, Path, Method>;
20
+ export type ApiResponse<Path extends ApiPath, Method extends SupportedMethod = "get"> = ClientResponse<paths, Path, Method>;
15
21
  /**
16
22
  * Get execution context type for kos API
17
23
  */
18
- export type ExecutionContext<Path extends ApiPath = ApiPath, Method extends HttpMethod = "get"> = KosExecutionContext<paths, Path, Method>;
24
+ export type ExecutionContext<Path extends ApiPath = ApiPath, Method extends HttpMethod = "get", Transformed = ApiResponse<Path, SupportedMethod & Method>> = KosExecutionContext<paths, Path, Method, Transformed>;
19
25
  /**
20
26
  * Typed decorator factory for @kosServiceRequest with kos API types
21
27
  *
@@ -38,11 +44,64 @@ export type ExecutionContext<Path extends ApiPath = ApiPath, Method extends Http
38
44
  * ```
39
45
  */
40
46
  export declare function kosServiceRequest<Path extends ApiPath, Method extends HttpMethod = "get", Response = any, TransformedResponse = Response>(params: IKosServiceRequestParams<paths, Path, Method, Response, TransformedResponse>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
47
+ /**
48
+ * One endpoint of the kos API: a path and the method it is called with.
49
+ */
50
+ export interface Endpoint {
51
+ path: ApiPath;
52
+ method: SupportedMethod;
53
+ }
54
+ /**
55
+ * Declare an endpoint once. The decorator config, the execution context type
56
+ * and the response type are all derived from the result, so a path string is
57
+ * never restated — and never drifts between the three.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * export const BoardApi = {
62
+ * list: endpoint("/api/board", "get"),
63
+ * update: endpoint("/api/board/{id}", "put"),
64
+ * } as const;
65
+ * ```
66
+ */
67
+ export declare function endpoint<Path extends ApiPath, Method extends SupportedMethod>(path: Path, method: Method): {
68
+ readonly path: Path;
69
+ readonly method: Method;
70
+ };
71
+ /**
72
+ * Execution context for an endpoint — the method-driven `$ctx` parameter type.
73
+ * Pass `Transformed` when the decorator declares a `transform`, so what the
74
+ * method receives is typed as the mapper's output rather than the raw response.
75
+ */
76
+ export type EndpointCtx<E extends Endpoint, Transformed = EndpointResponse<E>> = ExecutionContext<E["path"], E["method"], Transformed>;
77
+ /** Response body type for an endpoint. */
78
+ export type EndpointResponse<E extends Endpoint> = ApiResponse<E["path"], E["method"]>;
79
+ /**
80
+ * @kosServiceRequest preconfigured from an endpoint descriptor, defaulting to
81
+ * log-and-continue error handling. Pass overrides (lifecycle, errorHandler,
82
+ * cache, …) as the second argument.
83
+ *
84
+ * A `transform` narrows what the model receives: its return type becomes the
85
+ * handler's data type, so the raw response shape stops at the mapper.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * @serviceRequest(BoardApi.update)
90
+ * async renameBoard(name: string, $ctx?: EndpointCtx<typeof BoardApi.update>) {
91
+ * const data = await executeServiceRequest(this, $ctx, {
92
+ * pathParams: { id: this.id },
93
+ * body: { name },
94
+ * });
95
+ * if (!data) return;
96
+ * }
97
+ * ```
98
+ */
99
+ export declare function serviceRequest<E extends Endpoint, Transformed = EndpointResponse<E>>(ep: E, opts?: Partial<IKosServiceRequestParams<paths, E["path"], E["method"], EndpointResponse<E>, Transformed>>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
41
100
  /**
42
101
  * Create an API client for kos
43
102
  */
44
103
  export declare const api: {
45
- get: <K extends "/api/kos/network/interfaces" | "/api/kos/ui/plugins/context/{*name}" | "/api/kos/ui/plugins/contexts" | "/api/kos/localization/context/{*path}" | "/api/kos/localization/contexts" | "/api/kos/browser" | "/api/kos/browser/redirect" | "/api/kos/future/traces" | "/api/kos/future/traces/{traceId}/events" | "/api/kos/ota/paused" | "/api/kos/ota/artifacts" | "/api/kos/state/paths" | "/api/kos/state/{path}" | "/api/kos/hardware/resolver/identityMappings" | "/api/kos/config/schema" | "/api/kos/config/schema/{path}" | "/api/kos/config/{path}" | "/api/kos/config/details/{options}" | "/api/kos/config/details/{path}/{options}" | "/api/kos/config/value/merged/{scopedPath}/{attr}" | "/api/kos/config/value/{scopedPath}/{attr}" | "/api/kos/config/bean/defaults/{scopedPath}" | "/api/kos/config/bean/merged/{path}" | "/api/kos/config/bean/overrides/{scopedPath}" | "/api/kos/storage/devices" | "/api/kos/update/available" | "/api/kos/troubles" | "/api/kos/troubles/{troubleId}" | "/api/kos/handles" | "/api/kos/handles/{path}" | "/api/kos/handles/{path}/{view}" | "/api/kos/handles/views" | "/api/kos/openapi/{*baseUrl}" | "/api/kos/manifest/node" | "/api/kos/manifest/device" | "/api/kos/manifest/info" | "/api/kos/apps" | "/api/kos/apps/started" | "/api/kos/time/timezone" | "/api/kos/regions" | "/api/kos/regions/info" | "/api/kos/descriptor/{path}" | "/api/kos/descriptor/{path}/{dotted}" | "/api/kos/logs/rotateAll" | "/api/kos/logs/node/{nodeId}/streams" | "/api/kos/logs/node/{nodeId}/{stream}/blocks" | "/api/kos/logs/node/{nodeId}/{stream}/blocks/{blockId}" | "/api/kos/logs/rotate/{stream}" | "/api/kos/logs/overrides" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests" | "/api/kos/nodeMgr/blockedManifests" | "/api/kos/logs/groups" | "/api/kos/logs/overrides/{nodeType}" | "/api/kos/logs/overrides/{nodeType}/{typePrefix}" | "/api/kos/studio/properties" | "/api/kos/criticalData/sources" | "/api/kos/criticalData/data" | "/api/kos/criticalData/data/{name}" | "/api/kos/device" | "/api/kos/device/assemblies" | "/api/kos/device/serialNumber">(endpoint: K, params?: (paths[K]["get"] extends {
104
+ get: <K extends "/api/kos/network/interfaces" | "/api/kos/ui/plugins/context/{*name}" | "/api/kos/ui/plugins/contexts" | "/api/kos/localization/context/{*path}" | "/api/kos/localization/contexts" | "/api/kos/browser" | "/api/kos/browser/redirect" | "/api/kos/future/traces" | "/api/kos/future/traces/{traceId}/events" | "/api/kos/ota/paused" | "/api/kos/ota/artifacts" | "/api/kos/state/paths" | "/api/kos/state/{path}" | "/api/kos/hardware/resolver/identityMappings" | "/api/kos/config/schema" | "/api/kos/config/schema/{path}" | "/api/kos/config/{path}" | "/api/kos/config/details/{options}" | "/api/kos/config/details/{path}/{options}" | "/api/kos/config/value/merged/{scopedPath}/{attr}" | "/api/kos/config/value/{scopedPath}/{attr}" | "/api/kos/config/bean/defaults/{scopedPath}" | "/api/kos/config/bean/merged/{path}" | "/api/kos/config/bean/overrides/{scopedPath}" | "/api/kos/storage/devices" | "/api/kos/update/available" | "/api/kos/troubles" | "/api/kos/troubles/{troubleId}" | "/api/kos/handles" | "/api/kos/handles/{path}" | "/api/kos/handles/{path}/{view}" | "/api/kos/handles/views" | "/api/kos/openapi/{*baseUrl}" | "/api/kos/manifest/node" | "/api/kos/manifest/device" | "/api/kos/manifest/info" | "/api/kos/apps" | "/api/kos/apps/started" | "/api/kos/time/timezone" | "/api/kos/regions" | "/api/kos/regions/info" | "/api/kos/descriptor/{path}" | "/api/kos/descriptor/{path}/{dotted}" | "/api/kos/logs/rotateAll" | "/api/kos/logs/node/{nodeId}/streams" | "/api/kos/logs/node/{nodeId}/{stream}/blocks" | "/api/kos/logs/node/{nodeId}/{stream}/blocks/{blockId}" | "/api/kos/logs/rotate/{stream}" | "/api/kos/logs/overrides" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests" | "/api/kos/nodeMgr/blockedManifests" | "/api/kos/logs/groups" | "/api/kos/logs/overrides/{nodeType}" | "/api/kos/logs/overrides/{nodeType}/{typePrefix}" | "/api/kos/studio/properties" | "/api/kos/criticalData/sources" | "/api/kos/criticalData/data" | "/api/kos/criticalData/data/{name}" | "/api/kos/device" | "/api/kos/device/assemblies" | "/api/kos/device/serialNumber" | "/api/kos/future/active" | "/api/kos/udev/devices" | "/api/kos/udev/monitors" | "/api/kos/nodeMgr/node/{nodeId}/fallbacks" | "/api/kos/nodeMgr/node/{nodeId}/queues" | "/api/kos/nodeMgr/node/{nodeId}/queues/meta/activeQueue" | "/api/kos/nodeMgr/node/{nodeId}/queues/meta/effectiveQueueAtBoot" | "/api/kos/nodeMgr/node/{nodeId}/queues/meta/activeQueueAtBoot" | "/api/kos/nodeMgr/node/{nodeId}/queues/{name}" | "/api/kos/nodeMgr/node/{nodeId}/manifests/{queue}/{manifestId}/props" | "/api/kos/nodeMgr/node/{nodeId}/manifests/{queue}/{manifestId}/props/{key}" | "/api/kos/nodeMgr/node/{nodeId}/fallback/{queue}" | "/api/kos/context" | "/api/kos/gpio/chips" | "/api/kos/gpio/pins">(endpoint: K, params?: (paths[K]["get"] extends {
46
105
  parameters: infer P;
47
106
  } ? P : never) | undefined, options?: {
48
107
  ordered?: boolean | undefined;
@@ -58,7 +117,7 @@ export declare const api: {
58
117
  responseType?: "text" | "json" | "arraybuffer" | "blob" | undefined;
59
118
  retry?: (boolean | import('../../../../..').RetryConfig) | undefined;
60
119
  }) => Promise<import('../../../../../core/util/kos-service-request').ServiceResponse<ClientResponse<paths, K, "get">>>;
61
- post: <K extends "/api/kos/network/set-connection/{nodeId}" | "/api/kos/network/connect-node-to-wifi" | "/api/kos/browser/{nodeId}" | "/api/kos/browser/{nodeId}/{name}" | "/api/kos/browser/intent" | "/api/kos/browser/url" | "/api/kos/future/{futureId}/cancel" | "/api/kos/ota/resume/{name}" | "/api/kos/ota/cancel" | "/api/kos/ota/cancel/{name}" | "/api/kos/ota/pause/{name}" | "/api/kos/hardware/resolver/identityMappings/{boardPath}" | "/api/kos/config/{path}" | "/api/kos/config/bulk" | "/api/kos/update/install" | "/api/kos/troubles/resolve" | "/api/kos/troubles/resolve/{troubleId}" | "/api/kos/time/date" | "/api/kos/time/timezone" | "/api/kos/time/time" | "/api/kos/logs/node/{nodeId}/{stream}/subscribe" | "/api/kos/logs/node/{nodeId}/{stream}/unsubscribe" | "/api/kos/logs/overrides" | "/api/kos/nodeMgr/reboot" | "/api/kos/nodeMgr/node/{nodeId}/reboot" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests/{manifestId}" | "/api/kos/nodeMgr/blockedManifests/{manifestId}" | "/api/kos/criticalData/data" | "/api/kos/criticalData/data/{name}" | "/api/kos/device/serialNumber/{serialNum}">(endpoint: K, params?: (paths[K]["post"] extends {
120
+ post: <K extends "/api/kos/network/set-connection/{nodeId}" | "/api/kos/network/connect-node-to-wifi" | "/api/kos/browser/{nodeId}" | "/api/kos/browser/{nodeId}/{name}" | "/api/kos/browser/intent" | "/api/kos/browser/url" | "/api/kos/future/{futureId}/cancel" | "/api/kos/ota/resume/{name}" | "/api/kos/ota/cancel" | "/api/kos/ota/cancel/{name}" | "/api/kos/ota/pause/{name}" | "/api/kos/hardware/resolver/identityMappings/{boardPath}" | "/api/kos/config/{path}" | "/api/kos/config/bulk" | "/api/kos/update/install" | "/api/kos/troubles/resolve" | "/api/kos/troubles/resolve/{troubleId}" | "/api/kos/time/date" | "/api/kos/time/timezone" | "/api/kos/time/time" | "/api/kos/logs/node/{nodeId}/{stream}/subscribe" | "/api/kos/logs/node/{nodeId}/{stream}/unsubscribe" | "/api/kos/logs/overrides" | "/api/kos/nodeMgr/reboot" | "/api/kos/nodeMgr/node/{nodeId}/reboot" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests/{manifestId}" | "/api/kos/nodeMgr/blockedManifests/{manifestId}" | "/api/kos/criticalData/data" | "/api/kos/criticalData/data/{name}" | "/api/kos/device/serialNumber/{serialNum}" | "/api/kos/nodeMgr/node/{nodeId}/queues/meta/activeQueue/{name}" | "/api/kos/nodeMgr/node/{nodeId}/queues/{name}" | "/api/kos/nodeMgr/node/{nodeId}/queues/{queue}/{newName}" | "/api/kos/nodeMgr/node/{nodeId}/manifests/{queue}/{manifestId}/active" | "/api/kos/nodeMgr/node/{nodeId}/manifests/{queue}/{manifestId}/props" | "/api/kos/nodeMgr/node/{nodeId}/fallback/{queue}/{fallbackQueue}" | "/api/kos/update/internalUpdate" | "/api/kos/update/internalUpdateAndReboot">(endpoint: K, params?: (paths[K]["post"] extends {
62
121
  parameters: infer P;
63
122
  } ? P : never) | undefined, body?: (paths[K]["post"] extends {
64
123
  requestBody: {
@@ -98,7 +157,7 @@ export declare const api: {
98
157
  responseType?: "text" | "json" | "arraybuffer" | "blob" | undefined;
99
158
  retry?: (boolean | import('../../../../..').RetryConfig) | undefined;
100
159
  }) => Promise<import('../../../../../core/util/kos-service-request').ServiceResponse<ClientResponse<paths, K, "put">>>;
101
- delete: <K extends "/api/kos/hardware/resolver/identityMappings/{boardPath}" | "/api/kos/logs/overrides" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests/{manifestId}" | "/api/kos/nodeMgr/blockedManifests/{manifestId}" | "/api/kos/criticalData/data/{name}">(endpoint: K, params?: (paths[K]["delete"] extends {
160
+ delete: <K extends "/api/kos/hardware/resolver/identityMappings/{boardPath}" | "/api/kos/logs/overrides" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests" | "/api/kos/nodeMgr/node/{nodeId}/blockedManifests/{manifestId}" | "/api/kos/nodeMgr/blockedManifests/{manifestId}" | "/api/kos/criticalData/data/{name}" | "/api/kos/nodeMgr/node/{nodeId}/queues/{name}" | "/api/kos/nodeMgr/node/{nodeId}/manifests/{queue}/{manifestId}" | "/api/kos/nodeMgr/node/{nodeId}/manifests/{queue}/{manifestId}/active" | "/api/kos/nodeMgr/node/{nodeId}/manifests/{queue}/{manifestId}/props/{key}">(endpoint: K, params?: (paths[K]["delete"] extends {
102
161
  parameters: infer P;
103
162
  } ? P : never) | undefined, body?: (paths[K]["put"] extends {
104
163
  requestBody: {
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/kos-ui-sdk/src/models/utils/services/kos/daily/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AACrG,OAAO,KAAK,EACV,UAAU,EACV,wBAAwB,EACzB,MAAM,yDAAyD,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC;AACxB,MAAM,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC;AAClC,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,WAAW,CACrB,IAAI,SAAS,OAAO,EACpB,MAAM,SAAS,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,IACtD,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAC1B,IAAI,SAAS,OAAO,GAAG,OAAO,EAC9B,MAAM,SAAS,UAAU,GAAG,KAAK,IAC/B,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,SAAS,OAAO,EACpB,MAAM,SAAS,UAAU,GAAG,KAAK,EACjC,QAAQ,GAAG,GAAG,EACd,mBAAmB,GAAG,QAAQ,EAE9B,MAAM,EAAE,wBAAwB,CAC9B,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,mBAAmB,CACpB,4FASF;AAED;;GAEG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwB,CAAC;AAEzC,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/kos-ui-sdk/src/models/utils/services/kos/daily/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AACrG,OAAO,KAAK,EACV,UAAU,EACV,wBAAwB,EACzB,MAAM,yDAAyD,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC;AACxB,MAAM,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC;AAClC,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,WAAW,CACrB,IAAI,SAAS,OAAO,EACpB,MAAM,SAAS,eAAe,GAAG,KAAK,IACpC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAC1B,IAAI,SAAS,OAAO,GAAG,OAAO,EAC9B,MAAM,SAAS,UAAU,GAAG,KAAK,EACjC,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,eAAe,GAA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,CAAC,EACX,gBAAgB,CAAC,CAAC,CAAC,EACnB,WAAW,CACZ,CACF,4FAaF;AAED;;GAEG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwB,CAAC;AAEzC,eAAe,GAAG,CAAC"}
@@ -1,51 +1,51 @@
1
1
  export interface paths {
2
- "/api/vfs": {
3
- parameters: {
4
- query?: never;
5
- header?: never;
6
- path?: never;
7
- cookie?: never;
8
- };
9
- /** Return the structure of the VFS. (v1.0) */
10
- get: {
11
- parameters: {
12
- query?: never;
13
- header?: never;
14
- path?: never;
15
- cookie?: never;
16
- };
17
- requestBody?: never;
18
- responses: {
19
- /** @description OK */
20
- 200: {
21
- headers: {
22
- [name: string]: unknown;
23
- };
24
- content: {
25
- "application/json": components["schemas"]["7482934b-52af-489c-ba46-d05c45c33100"];
26
- };
2
+ "/api/vfs": {
3
+ parameters: {
4
+ query?: never;
5
+ header?: never;
6
+ path?: never;
7
+ cookie?: never;
8
+ };
9
+ /** Return the structure of the VFS. (v1.0) */
10
+ get: {
11
+ parameters: {
12
+ query?: never;
13
+ header?: never;
14
+ path?: never;
15
+ cookie?: never;
16
+ };
17
+ requestBody?: never;
18
+ responses: {
19
+ /** @description OK */
20
+ 200: {
21
+ headers: {
22
+ [name: string]: unknown;
23
+ };
24
+ content: {
25
+ "application/json": components["schemas"]["7377fe1a-07be-4d53-a475-50b722868d11"];
26
+ };
27
+ };
28
+ };
27
29
  };
28
- };
30
+ put?: never;
31
+ post?: never;
32
+ delete?: never;
33
+ options?: never;
34
+ head?: never;
35
+ patch?: never;
36
+ trace?: never;
29
37
  };
30
- put?: never;
31
- post?: never;
32
- delete?: never;
33
- options?: never;
34
- head?: never;
35
- patch?: never;
36
- trace?: never;
37
- };
38
38
  }
39
39
  export type webhooks = Record<string, never>;
40
40
  export interface components {
41
- schemas: {
42
- "7482934b-52af-489c-ba46-d05c45c33100": unknown;
43
- };
44
- responses: never;
45
- parameters: never;
46
- requestBodies: never;
47
- headers: never;
48
- pathItems: never;
41
+ schemas: {
42
+ "7377fe1a-07be-4d53-a475-50b722868d11": unknown;
43
+ };
44
+ responses: never;
45
+ parameters: never;
46
+ requestBodies: never;
47
+ headers: never;
48
+ pathItems: never;
49
49
  }
50
50
  export type $defs = Record<string, never>;
51
51
  export type operations = Record<string, never>;
@@ -8,14 +8,20 @@ import { paths } from './openapi';
8
8
  export type Api = paths;
9
9
  export type ApiPath = keyof paths;
10
10
  export type ValidPaths = PathsByMethod<paths>;
11
+ /**
12
+ * Methods a response type can be derived for — the lowercase subset of
13
+ * HttpMethod. The uppercase spellings HttpMethod also permits do not match the
14
+ * keys of an OpenAPI `paths` object, so they would silently yield `unknown`.
15
+ */
16
+ export type SupportedMethod = "get" | "post" | "put" | "delete" | "patch";
11
17
  /**
12
18
  * Get client response type for vfs API
13
19
  */
14
- export type ApiResponse<Path extends ApiPath, Method extends "get" | "post" | "put" | "delete" = "get"> = ClientResponse<paths, Path, Method>;
20
+ export type ApiResponse<Path extends ApiPath, Method extends SupportedMethod = "get"> = ClientResponse<paths, Path, Method>;
15
21
  /**
16
22
  * Get execution context type for vfs API
17
23
  */
18
- export type ExecutionContext<Path extends ApiPath = ApiPath, Method extends HttpMethod = "get"> = KosExecutionContext<paths, Path, Method>;
24
+ export type ExecutionContext<Path extends ApiPath = ApiPath, Method extends HttpMethod = "get", Transformed = ApiResponse<Path, SupportedMethod & Method>> = KosExecutionContext<paths, Path, Method, Transformed>;
19
25
  /**
20
26
  * Typed decorator factory for @kosServiceRequest with vfs API types
21
27
  *
@@ -38,6 +44,59 @@ export type ExecutionContext<Path extends ApiPath = ApiPath, Method extends Http
38
44
  * ```
39
45
  */
40
46
  export declare function kosServiceRequest<Path extends ApiPath, Method extends HttpMethod = "get", Response = any, TransformedResponse = Response>(params: IKosServiceRequestParams<paths, Path, Method, Response, TransformedResponse>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
47
+ /**
48
+ * One endpoint of the vfs API: a path and the method it is called with.
49
+ */
50
+ export interface Endpoint {
51
+ path: ApiPath;
52
+ method: SupportedMethod;
53
+ }
54
+ /**
55
+ * Declare an endpoint once. The decorator config, the execution context type
56
+ * and the response type are all derived from the result, so a path string is
57
+ * never restated — and never drifts between the three.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * export const BoardApi = {
62
+ * list: endpoint("/api/board", "get"),
63
+ * update: endpoint("/api/board/{id}", "put"),
64
+ * } as const;
65
+ * ```
66
+ */
67
+ export declare function endpoint<Path extends ApiPath, Method extends SupportedMethod>(path: Path, method: Method): {
68
+ readonly path: Path;
69
+ readonly method: Method;
70
+ };
71
+ /**
72
+ * Execution context for an endpoint — the method-driven `$ctx` parameter type.
73
+ * Pass `Transformed` when the decorator declares a `transform`, so what the
74
+ * method receives is typed as the mapper's output rather than the raw response.
75
+ */
76
+ export type EndpointCtx<E extends Endpoint, Transformed = EndpointResponse<E>> = ExecutionContext<E["path"], E["method"], Transformed>;
77
+ /** Response body type for an endpoint. */
78
+ export type EndpointResponse<E extends Endpoint> = ApiResponse<E["path"], E["method"]>;
79
+ /**
80
+ * @kosServiceRequest preconfigured from an endpoint descriptor, defaulting to
81
+ * log-and-continue error handling. Pass overrides (lifecycle, errorHandler,
82
+ * cache, …) as the second argument.
83
+ *
84
+ * A `transform` narrows what the model receives: its return type becomes the
85
+ * handler's data type, so the raw response shape stops at the mapper.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * @serviceRequest(BoardApi.update)
90
+ * async renameBoard(name: string, $ctx?: EndpointCtx<typeof BoardApi.update>) {
91
+ * const data = await executeServiceRequest(this, $ctx, {
92
+ * pathParams: { id: this.id },
93
+ * body: { name },
94
+ * });
95
+ * if (!data) return;
96
+ * }
97
+ * ```
98
+ */
99
+ export declare function serviceRequest<E extends Endpoint, Transformed = EndpointResponse<E>>(ep: E, opts?: Partial<IKosServiceRequestParams<paths, E["path"], E["method"], EndpointResponse<E>, Transformed>>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
41
100
  /**
42
101
  * Create an API client for vfs
43
102
  */
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/kos-ui-sdk/src/models/utils/services/vfs/daily/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AACrG,OAAO,KAAK,EACV,UAAU,EACV,wBAAwB,EACzB,MAAM,yDAAyD,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC;AACxB,MAAM,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC;AAClC,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,WAAW,CACrB,IAAI,SAAS,OAAO,EACpB,MAAM,SAAS,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,IACtD,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAC1B,IAAI,SAAS,OAAO,GAAG,OAAO,EAC9B,MAAM,SAAS,UAAU,GAAG,KAAK,IAC/B,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,SAAS,OAAO,EACpB,MAAM,SAAS,UAAU,GAAG,KAAK,EACjC,QAAQ,GAAG,GAAG,EACd,mBAAmB,GAAG,QAAQ,EAE9B,MAAM,EAAE,wBAAwB,CAC9B,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,mBAAmB,CACpB,4FASF;AAED;;GAEG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwB,CAAC;AAEzC,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/kos-ui-sdk/src/models/utils/services/vfs/daily/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AACrG,OAAO,KAAK,EACV,UAAU,EACV,wBAAwB,EACzB,MAAM,yDAAyD,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC;AACxB,MAAM,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC;AAClC,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,WAAW,CACrB,IAAI,SAAS,OAAO,EACpB,MAAM,SAAS,eAAe,GAAG,KAAK,IACpC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAC1B,IAAI,SAAS,OAAO,GAAG,OAAO,EAC9B,MAAM,SAAS,UAAU,GAAG,KAAK,EAC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L,CAAC,CAAC,MAAM,CAAC,EACT,CAAC,CAAC,QAAQ,CAAC,EACX,gBAAgB,CAAC,CAAC,CAAC,EACnB,WAAW,CACZ,CACF,4FAaF;AAED;;GAEG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwB,CAAC;AAEzC,eAAe,GAAG,CAAC"}
@@ -1,9 +1,9 @@
1
+ export * as KOS_SERVICE from './services/kos/daily/service';
1
2
  export * as KOS_SERVICE_1_6_5 from './services/kos/1.6.5/service';
2
3
  export * as KOS_SERVICE_1_8_1 from './services/kos/1.8.1/service';
3
4
  export * as KOS_SERVICE_1_9_X from './services/kos/1.9.x/service';
4
- export * as KOS_SERVICE from './services/kos/daily/service';
5
+ export * as VFS_SERVICE from './services/vfs/daily/service';
5
6
  export * as VFS_SERVICE_1_6_5 from './services/vfs/1.6.5/service';
6
7
  export * as VFS_SERVICE_1_8_1 from './services/vfs/1.8.1/service';
7
8
  export * as VFS_SERVICE_1_9_X from './services/vfs/1.9.x/service';
8
- export * as VFS_SERVICE from './services/vfs/daily/service';
9
9
  //# sourceMappingURL=services-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"services-index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/models/utils/services-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"services-index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/models/utils/services-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-ui-sdk",
3
- "version": "0.1.0-next.867",
3
+ "version": "0.1.0-next.871",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -50,7 +50,7 @@
50
50
  "react-router-dom": "^6.11.2"
51
51
  },
52
52
  "dependencies": {
53
- "@kosdev-code/kos-api-levels": "0.1.0-next.867",
53
+ "@kosdev-code/kos-api-levels": "0.1.0-next.871",
54
54
  "mobx": "^6.9.0",
55
55
  "mobx-react-lite": "^3.4.3",
56
56
  "date-fns": "^2.30.0",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "kos": {
61
61
  "build": {
62
- "gitHash": "582b99ec0f379e7d51b412e78c045aa16c65d693"
62
+ "gitHash": "e137eed4b414b79d2a5afcde28f43544a56eb557"
63
63
  }
64
64
  }
65
65
  }
package/testing.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("mobx");
4
- const service = require("./index-D8aw-T5w.cjs");
4
+ const service = require("./index-DsRhHHtS.cjs");
5
5
  require("loglevel");
6
6
  let booted;
7
7
  function bootKosCore(registration, options = {}) {
package/testing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "mobx";
2
- import { b0 as KosMock, l as KosCore } from "./index-CvCXisvT.js";
2
+ import { b0 as KosMock, l as KosCore } from "./index-D64IOwMG.js";
3
3
  import "loglevel";
4
4
  let booted;
5
5
  function bootKosCore(registration, options = {}) {