akanjs 2.2.4-rc.1 → 2.2.4-rc.2
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/{signal → common}/fileUpload.ts +12 -9
- package/common/index.ts +5 -0
- package/fetch/client/fetchClient.ts +7 -2
- package/package.json +1 -1
- package/signal/index.ts +0 -1
- package/store/action.ts +10 -2
- package/types/{signal → common}/fileUpload.d.ts +10 -9
- package/types/common/index.d.ts +1 -0
- package/types/signal/index.d.ts +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
interface FileUploadSerializedEndpoint {
|
|
2
|
+
fileUpload?: boolean;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface FileUploadSerializedSignal {
|
|
6
|
+
prefix?: string;
|
|
7
|
+
endpoint: Record<string, FileUploadSerializedEndpoint>;
|
|
8
|
+
}
|
|
2
9
|
|
|
3
|
-
/**
|
|
4
|
-
* Framework-owned file-upload contract. A plugin opts in by marking exactly one
|
|
5
|
-
* upload mutation with `{ fileUpload: true }`; the multipart form must use these
|
|
6
|
-
* field names and the metas shape below.
|
|
7
|
-
*/
|
|
10
|
+
/** Framework-owned file-upload contract shared by client-safe packages. */
|
|
8
11
|
export const fileUploadContract = {
|
|
9
12
|
fields: { files: "files", metas: "metas", type: "type", parentId: "parentId" },
|
|
10
13
|
buildMetas: (fileList: FileList) =>
|
|
@@ -18,9 +21,9 @@ export interface FileUploadCapability {
|
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
/** Discovers the upload endpoint marked with `{ fileUpload: true }` from the serialized signal. */
|
|
21
|
-
export const resolveFileUploadCapability = (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
export const resolveFileUploadCapability = (
|
|
25
|
+
serializedSignal: Record<string, FileUploadSerializedSignal>,
|
|
26
|
+
): FileUploadCapability | null => {
|
|
24
27
|
const matches: FileUploadCapability[] = [];
|
|
25
28
|
for (const [refName, signal] of Object.entries(serializedSignal))
|
|
26
29
|
for (const [endpointKey, endpoint] of Object.entries(signal.endpoint))
|
package/common/index.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { applyMixins } from "./applyMixins";
|
|
2
2
|
export { capitalize } from "./capitalize";
|
|
3
3
|
export { deepObjectify } from "./deepObjectify";
|
|
4
|
+
export {
|
|
5
|
+
type FileUploadCapability,
|
|
6
|
+
fileUploadContract,
|
|
7
|
+
resolveFileUploadCapability,
|
|
8
|
+
} from "./fileUpload";
|
|
4
9
|
export { formatNumber } from "./formatNumber";
|
|
5
10
|
export { formatPhone } from "./formatPhone";
|
|
6
11
|
export { getAllPropertyDescriptors } from "./getAllPropertyDescriptors";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { DataList, getEnv, PrimitiveRegistry, type PromiseOrObject } from "akanjs/base";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
capitalize,
|
|
4
|
+
type FetchPolicy,
|
|
5
|
+
fileUploadContract,
|
|
6
|
+
Logger,
|
|
7
|
+
resolveFileUploadCapability,
|
|
8
|
+
} from "akanjs/common";
|
|
3
9
|
import { type BaseInsight, type BaseObject, ConstantRegistry, deserialize, serialize } from "akanjs/constant";
|
|
4
10
|
import type {
|
|
5
11
|
DatabaseSignal,
|
|
@@ -10,7 +16,6 @@ import type {
|
|
|
10
16
|
SerializedSlice,
|
|
11
17
|
ServiceSignal,
|
|
12
18
|
} from "akanjs/signal";
|
|
13
|
-
import { fileUploadContract, resolveFileUploadCapability } from "akanjs/signal/fileUpload";
|
|
14
19
|
import type { ClientSignal, MergeAllFetchTypes, SliceMeta } from "../fetchType";
|
|
15
20
|
import { memoizeRequestQuery, cookies as requestCookies, headers as requestHeaders } from "../requestStorage";
|
|
16
21
|
import type { GetSliceMetaObjFromDatabaseSignals } from "../types";
|
package/package.json
CHANGED
package/signal/index.ts
CHANGED
package/store/action.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { DataList, type Dayjs, FIELD_META, type GetStateObject, type SLICE_META } from "akanjs/base";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
capitalize,
|
|
4
|
+
deepObjectify,
|
|
5
|
+
type FetchPolicy,
|
|
6
|
+
isQueryEqual,
|
|
7
|
+
Logger,
|
|
8
|
+
lowerlize,
|
|
9
|
+
pathSet,
|
|
10
|
+
resolveFileUploadCapability,
|
|
11
|
+
} from "akanjs/common";
|
|
3
12
|
import {
|
|
4
13
|
type BaseInsight,
|
|
5
14
|
type BaseObject,
|
|
@@ -12,7 +21,6 @@ import {
|
|
|
12
21
|
import type { BaseFilterSortKey, ExtractSort, FilterInstance } from "akanjs/document";
|
|
13
22
|
import type { FetchInitForm, FetchProxy } from "akanjs/fetch";
|
|
14
23
|
import type { SerializedSlice, SliceCls, SliceInfoArgs } from "akanjs/signal";
|
|
15
|
-
import { resolveFileUploadCapability } from "akanjs/signal/fileUpload";
|
|
16
24
|
import type { SliceStateKey } from "./state";
|
|
17
25
|
import type { SetGet } from "./types";
|
|
18
26
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
interface FileUploadSerializedEndpoint {
|
|
2
|
+
fileUpload?: boolean;
|
|
3
|
+
}
|
|
4
|
+
interface FileUploadSerializedSignal {
|
|
5
|
+
prefix?: string;
|
|
6
|
+
endpoint: Record<string, FileUploadSerializedEndpoint>;
|
|
7
|
+
}
|
|
8
|
+
/** Framework-owned file-upload contract shared by client-safe packages. */
|
|
7
9
|
export declare const fileUploadContract: {
|
|
8
10
|
readonly fields: {
|
|
9
11
|
readonly files: "files";
|
|
@@ -22,6 +24,5 @@ export interface FileUploadCapability {
|
|
|
22
24
|
prefix?: string;
|
|
23
25
|
}
|
|
24
26
|
/** Discovers the upload endpoint marked with `{ fileUpload: true }` from the serialized signal. */
|
|
25
|
-
export declare const resolveFileUploadCapability: (serializedSignal:
|
|
26
|
-
|
|
27
|
-
}) => FileUploadCapability | null;
|
|
27
|
+
export declare const resolveFileUploadCapability: (serializedSignal: Record<string, FileUploadSerializedSignal>) => FileUploadCapability | null;
|
|
28
|
+
export {};
|
package/types/common/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { applyMixins } from "./applyMixins.d.ts";
|
|
2
2
|
export { capitalize } from "./capitalize.d.ts";
|
|
3
3
|
export { deepObjectify } from "./deepObjectify.d.ts";
|
|
4
|
+
export { type FileUploadCapability, fileUploadContract, resolveFileUploadCapability, } from "./fileUpload.d.ts";
|
|
4
5
|
export { formatNumber } from "./formatNumber.d.ts";
|
|
5
6
|
export { formatPhone } from "./formatPhone.d.ts";
|
|
6
7
|
export { getAllPropertyDescriptors } from "./getAllPropertyDescriptors.d.ts";
|
package/types/signal/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from "./base.signal";
|
|
|
2
2
|
export * from "./endpoint.d.ts";
|
|
3
3
|
export * from "./endpointInfo.d.ts";
|
|
4
4
|
export * from "./exception.d.ts";
|
|
5
|
-
export * from "./fileUpload.d.ts";
|
|
6
5
|
export * from "./guard.d.ts";
|
|
7
6
|
export * from "./guards.d.ts";
|
|
8
7
|
export * from "./intercept.d.ts";
|