@fabriktor/client 0.0.35 → 0.0.36

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.
@@ -1,13 +1,10 @@
1
1
  import { OperationResultValueKey, SearchResultResultsKey, type OperationResult, type SearchResult, type UpsertResult } from "@fabriktor/schema";
2
+ import { type ReplaceOptionalField } from "./type.js";
2
3
  import type { TokenProvider } from "./auth.js";
3
4
  import { type QueryOptions } from "./col.js";
4
5
  import type { HTTPDoer } from "./http.js";
5
- export type OperationResultOf<T> = Omit<OperationResult, typeof OperationResultValueKey> & {
6
- [OperationResultValueKey]?: T;
7
- };
8
- export type SearchResultOf<T> = Omit<SearchResult, typeof SearchResultResultsKey> & {
9
- [SearchResultResultsKey]?: T[];
10
- };
6
+ export type OperationResultOf<T> = ReplaceOptionalField<OperationResult, typeof OperationResultValueKey, T>;
7
+ export type SearchResultOf<T> = ReplaceOptionalField<SearchResult, typeof SearchResultResultsKey, T[]>;
11
8
  export type CRUDClientOptions = {
12
9
  http: HTTPDoer;
13
10
  base_url: string;
@@ -3,7 +3,7 @@
3
3
  // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
4
  // not use this file except in compliance with the License. You may obtain
5
5
  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- import { HTTPMethodDelete, HTTPMethodGet, HTTPMethodPatch, HTTPMethodPost, OperationResultValueKey, PathSearch, SearchResultResultsKey, } from "@fabriktor/schema";
6
+ import { HTTPMethodDelete, HTTPMethodGet, HTTPMethodPatch, HTTPMethodPost, PathSearch, } from "@fabriktor/schema";
7
7
  import { requiredToken } from "./auth.js";
8
8
  import { collectionPath, idPath, withQuery } from "./col.js";
9
9
  import { buildPath } from "./path.js";
@@ -0,0 +1,7 @@
1
+ export type ReplaceField<T extends object, K extends keyof T, V> = Omit<T, K> & {
2
+ [P in K]: V;
3
+ };
4
+ export type ReplaceOptionalField<T extends object, K extends keyof T, V> = Omit<T, K> & {
5
+ [P in K]?: V;
6
+ };
7
+ export type OptionalField<T extends object, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -0,0 +1,6 @@
1
+ // Copyright (C) Fabriktor, Inc. 2025-present.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+ // not use this file except in compliance with the License. You may obtain
5
+ // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ export {};
@@ -11,6 +11,7 @@ export * from "./core/http.js";
11
11
  export * from "./core/idempotency.js";
12
12
  export * from "./core/multipart.js";
13
13
  export * from "./core/path.js";
14
+ export * from "./core/type.js";
14
15
  export * from "./core/ws.js";
15
16
  export * from "./feed/feed.js";
16
17
  export * from "./fulfillments/fulfillments.js";
package/dist/src/index.js CHANGED
@@ -11,6 +11,7 @@ export * from "./core/http.js";
11
11
  export * from "./core/idempotency.js";
12
12
  export * from "./core/multipart.js";
13
13
  export * from "./core/path.js";
14
+ export * from "./core/type.js";
14
15
  export * from "./core/ws.js";
15
16
  export * from "./feed/feed.js";
16
17
  export * from "./fulfillments/fulfillments.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {