@edgestore/server 0.1.5-alpha.9 → 0.1.6
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/dist/adapters/express/index.d.ts +18 -0
- package/dist/adapters/express/index.d.ts.map +1 -0
- package/dist/adapters/express/index.js +117 -0
- package/dist/adapters/express/index.mjs +113 -0
- package/dist/adapters/next/app/index.d.ts +1 -3
- package/dist/adapters/next/app/index.d.ts.map +1 -1
- package/dist/adapters/next/app/index.js +20 -16
- package/dist/adapters/next/app/index.mjs +9 -5
- package/dist/adapters/next/pages/index.d.ts +1 -3
- package/dist/adapters/next/pages/index.d.ts.map +1 -1
- package/dist/adapters/next/pages/index.js +18 -16
- package/dist/adapters/next/pages/index.mjs +7 -5
- package/dist/adapters/shared.d.ts +7 -43
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/core/client/index.d.ts +4 -10
- package/dist/core/client/index.d.ts.map +1 -1
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -13
- package/dist/core/index.mjs +5 -14
- package/dist/core/sdk/index.d.ts +1 -2
- package/dist/core/sdk/index.d.ts.map +1 -1
- package/dist/{index-537039e4.mjs → index-28efdacf.mjs} +3 -39
- package/dist/{index-874abae5.js → index-4491caf0.js} +3 -41
- package/dist/{index-b8745c2f.js → index-beed799d.js} +3 -34
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -215
- package/dist/index.mjs +1 -218
- package/dist/libs/errors/EdgeStoreCredentialsError.d.ts.map +1 -1
- package/dist/{logger-7ea2248c.mjs → logger-09f43a75.mjs} +14 -3
- package/dist/{logger-b530a3e1.js → logger-dcb682ae.js} +14 -3
- package/dist/providers/aws/index.d.ts +1 -1
- package/dist/providers/aws/index.d.ts.map +1 -1
- package/dist/providers/azure/index.d.ts +1 -1
- package/dist/providers/azure/index.d.ts.map +1 -1
- package/dist/providers/edgestore/index.d.ts +1 -1
- package/dist/providers/edgestore/index.d.ts.map +1 -1
- package/dist/providers/edgestore/index.js +4 -4
- package/dist/providers/edgestore/index.mjs +2 -2
- package/dist/{shared-6b717151.mjs → shared-039276af.mjs} +1 -1
- package/dist/{shared-4c2a6210.js → shared-7c700083.js} +20 -20
- package/dist/{shared-e84dbdde.js → shared-83f288f6.js} +1 -1
- package/package.json +8 -12
- package/src/adapters/express/index.ts +165 -0
- package/src/adapters/next/app/index.ts +12 -7
- package/src/adapters/next/pages/index.ts +10 -7
- package/src/adapters/shared.ts +14 -17
- package/src/core/client/index.ts +9 -12
- package/src/core/index.ts +0 -15
- package/src/core/sdk/index.ts +6 -3
- package/src/index.ts +1 -1
- package/src/libs/errors/EdgeStoreCredentialsError.ts +1 -2
- package/src/providers/aws/index.ts +1 -1
- package/src/providers/azure/index.ts +1 -1
- package/src/providers/edgestore/index.ts +5 -2
- package/dist/adapters/index.d.ts +0 -2
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -2
- package/dist/adapters/index.mjs +0 -1
- package/dist/core/internals/bucketBuilder.d.ts +0 -269
- package/dist/core/internals/bucketBuilder.d.ts.map +0 -1
- package/dist/core/internals/createPathParamProxy.d.ts +0 -21
- package/dist/core/internals/createPathParamProxy.d.ts.map +0 -1
- package/dist/libs/errors/EdgeStoreApiClientError.d.ts +0 -8
- package/dist/libs/errors/EdgeStoreApiClientError.d.ts.map +0 -1
- package/dist/libs/errors/EdgeStoreError.d.ts +0 -48
- package/dist/libs/errors/EdgeStoreError.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -2
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -2
- package/dist/providers/index.mjs +0 -1
- package/dist/providers/types.d.ts +0 -114
- package/dist/providers/types.d.ts.map +0 -1
- package/dist/types.d.ts +0 -94
- package/dist/types.d.ts.map +0 -1
- package/src/adapters/index.ts +0 -6
- package/src/core/internals/bucketBuilder.ts +0 -555
- package/src/core/internals/createPathParamProxy.ts +0 -40
- package/src/libs/errors/EdgeStoreApiClientError.ts +0 -14
- package/src/libs/errors/EdgeStoreError.ts +0 -92
- package/src/providers/index.ts +0 -1
- package/src/providers/types.ts +0 -140
- package/src/types.ts +0 -148
package/src/providers/types.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AnyBuilder,
|
|
3
|
-
type AnyMetadata,
|
|
4
|
-
type EdgeStoreRouter,
|
|
5
|
-
} from '../core/internals/bucketBuilder';
|
|
6
|
-
import { type MaybePromise } from '../types';
|
|
7
|
-
|
|
8
|
-
export type InitParams = {
|
|
9
|
-
ctx: any;
|
|
10
|
-
router: EdgeStoreRouter<any>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type InitRes = {
|
|
14
|
-
token?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type GetFileParams = {
|
|
18
|
-
url: string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type GetFileRes = {
|
|
22
|
-
url: string;
|
|
23
|
-
size: number;
|
|
24
|
-
uploadedAt: Date;
|
|
25
|
-
path: {
|
|
26
|
-
[key: string]: string;
|
|
27
|
-
};
|
|
28
|
-
metadata: {
|
|
29
|
-
[key: string]: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type RequestUploadParams = {
|
|
34
|
-
multipart?: {
|
|
35
|
-
uploadId?: string;
|
|
36
|
-
parts: number[];
|
|
37
|
-
};
|
|
38
|
-
bucketName: string;
|
|
39
|
-
bucketType: string;
|
|
40
|
-
fileInfo: {
|
|
41
|
-
size: number;
|
|
42
|
-
extension: string;
|
|
43
|
-
isPublic: boolean;
|
|
44
|
-
fileName?: string;
|
|
45
|
-
path: {
|
|
46
|
-
key: string;
|
|
47
|
-
value: string;
|
|
48
|
-
}[];
|
|
49
|
-
metadata: AnyMetadata;
|
|
50
|
-
replaceTargetUrl?: string;
|
|
51
|
-
temporary: boolean;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export type RequestUploadPartsParams = {
|
|
56
|
-
multipart: {
|
|
57
|
-
uploadId: string;
|
|
58
|
-
parts: number[];
|
|
59
|
-
};
|
|
60
|
-
path: string;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export type RequestUploadPartsRes = {
|
|
64
|
-
multipart: {
|
|
65
|
-
uploadId: string;
|
|
66
|
-
parts: {
|
|
67
|
-
partNumber: number;
|
|
68
|
-
uploadUrl: string;
|
|
69
|
-
}[];
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export type CompleteMultipartUploadParams = {
|
|
74
|
-
uploadId: string;
|
|
75
|
-
key: string;
|
|
76
|
-
parts: {
|
|
77
|
-
partNumber: number;
|
|
78
|
-
eTag: string;
|
|
79
|
-
}[];
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export type CompleteMultipartUploadRes = {
|
|
83
|
-
success: boolean;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export type RequestUploadRes =
|
|
87
|
-
| {
|
|
88
|
-
uploadUrl: string;
|
|
89
|
-
accessUrl: string;
|
|
90
|
-
thumbnailUrl?: string | null;
|
|
91
|
-
}
|
|
92
|
-
| {
|
|
93
|
-
multipart: {
|
|
94
|
-
key: string;
|
|
95
|
-
uploadId: string;
|
|
96
|
-
partSize: number;
|
|
97
|
-
totalParts: number;
|
|
98
|
-
parts: {
|
|
99
|
-
partNumber: number;
|
|
100
|
-
uploadUrl: string;
|
|
101
|
-
}[];
|
|
102
|
-
};
|
|
103
|
-
accessUrl: string;
|
|
104
|
-
thumbnailUrl?: string | null;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export type ConfirmUpload = {
|
|
108
|
-
bucket: AnyBuilder;
|
|
109
|
-
url: string;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export type ConfirmUploadRes = {
|
|
113
|
-
success: boolean;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export type DeleteFileParams = {
|
|
117
|
-
bucket: AnyBuilder;
|
|
118
|
-
url: string;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export type DeleteFileRes = {
|
|
122
|
-
success: boolean;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type Provider = {
|
|
126
|
-
init: (params: InitParams) => MaybePromise<InitRes>;
|
|
127
|
-
getBaseUrl: () => MaybePromise<string>;
|
|
128
|
-
getFile: (params: GetFileParams) => MaybePromise<GetFileRes>;
|
|
129
|
-
requestUpload: (
|
|
130
|
-
params: RequestUploadParams,
|
|
131
|
-
) => MaybePromise<RequestUploadRes>;
|
|
132
|
-
requestUploadParts: (
|
|
133
|
-
params: RequestUploadPartsParams,
|
|
134
|
-
) => MaybePromise<RequestUploadPartsRes>;
|
|
135
|
-
completeMultipartUpload: (
|
|
136
|
-
params: CompleteMultipartUploadParams,
|
|
137
|
-
) => MaybePromise<CompleteMultipartUploadRes>;
|
|
138
|
-
confirmUpload: (params: ConfirmUpload) => MaybePromise<ConfirmUploadRes>;
|
|
139
|
-
deleteFile: (params: DeleteFileParams) => MaybePromise<DeleteFileRes>;
|
|
140
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export type identity<TType> = TType;
|
|
5
|
-
|
|
6
|
-
export type InferOptional<TType, TKeys extends keyof TType> = Omit<
|
|
7
|
-
TType,
|
|
8
|
-
TKeys
|
|
9
|
-
> &
|
|
10
|
-
Partial<Pick<TType, TKeys>>;
|
|
11
|
-
|
|
12
|
-
export type UndefinedKeys<TType> = {
|
|
13
|
-
[K in keyof TType]: undefined extends TType[K] ? K : never;
|
|
14
|
-
}[keyof TType];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
export type FlatOverwrite<TType, TWith> = InferOptional<
|
|
20
|
-
{
|
|
21
|
-
[TKey in keyof TType | keyof TWith]: TKey extends keyof TWith
|
|
22
|
-
? TWith[TKey]
|
|
23
|
-
: TKey extends keyof TType
|
|
24
|
-
? TType[TKey]
|
|
25
|
-
: never;
|
|
26
|
-
},
|
|
27
|
-
UndefinedKeys<TType> | UndefinedKeys<TWith>
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
export type IntersectionError<TKey extends string> =
|
|
34
|
-
`The property '${TKey}' in your router collides with a built-in method, rename this router or procedure on your backend.`;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
export type ProtectedIntersection<TType, TWith> = keyof TType &
|
|
40
|
-
keyof TWith extends never
|
|
41
|
-
? TType & TWith
|
|
42
|
-
: IntersectionError<string & keyof TType & keyof TWith>;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
export type Maybe<TType> = TType | null | undefined;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
|
-
export type ThenArg<TType> = TType extends PromiseLike<infer U>
|
|
53
|
-
? ThenArg<U>
|
|
54
|
-
: TType;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @internal
|
|
58
|
-
* @see https://github.com/ianstormtaylor/superstruct/blob/7973400cd04d8ad92bbdc2b6f35acbfb3c934079/src/utils.ts#L323-L325
|
|
59
|
-
*/
|
|
60
|
-
export type Simplify<TType> = TType extends any[] | Date
|
|
61
|
-
? TType
|
|
62
|
-
: { [K in keyof TType]: TType[K] };
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
export type Prettify<TType> = {
|
|
68
|
-
[K in keyof TType]: TType[K];
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
70
|
-
} & {};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
export type Dict<TType> = Record<string, TType | undefined>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @public
|
|
79
|
-
*/
|
|
80
|
-
export type MaybePromise<TType> = Promise<TType> | TType;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @internal
|
|
84
|
-
*
|
|
85
|
-
* Creates a "lower-priority" type inference.
|
|
86
|
-
* https://github.com/microsoft/TypeScript/issues/14829#issuecomment-322267089
|
|
87
|
-
*/
|
|
88
|
-
export type InferLast<TType> = TType & {
|
|
89
|
-
[KeyType in keyof TType]: TType[KeyType];
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
export type inferAsyncReturnType<TFunction extends (...args: any) => any> =
|
|
96
|
-
ThenArg<ReturnType<TFunction>>;
|
|
97
|
-
|
|
98
|
-
export type FilterKeys<TObj extends object, TFilter> = {
|
|
99
|
-
[TKey in keyof TObj]: TObj[TKey] extends TFilter ? TKey : never;
|
|
100
|
-
}[keyof TObj];
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @internal
|
|
104
|
-
*/
|
|
105
|
-
export type Filter<TObj extends object, TFilter> = Pick<
|
|
106
|
-
TObj,
|
|
107
|
-
FilterKeys<TObj, TFilter>
|
|
108
|
-
>;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Unwrap return type if the type is a function (sync or async), else use the type as is
|
|
112
|
-
* @internal
|
|
113
|
-
*/
|
|
114
|
-
export type Unwrap<TType> = TType extends (...args: any[]) => infer R
|
|
115
|
-
? ThenArg<R>
|
|
116
|
-
: TType;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Makes the object recursively optional.
|
|
120
|
-
* @internal
|
|
121
|
-
*/
|
|
122
|
-
export type DeepPartial<TObject> = TObject extends object
|
|
123
|
-
? {
|
|
124
|
-
[P in keyof TObject]?: DeepPartial<TObject[P]>;
|
|
125
|
-
}
|
|
126
|
-
: TObject;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Get the keys of a union type.
|
|
130
|
-
* @internal
|
|
131
|
-
*/
|
|
132
|
-
export type KeysOfUnion<TUnion> = TUnion extends TUnion
|
|
133
|
-
? keyof TUnion extends string
|
|
134
|
-
? keyof TUnion
|
|
135
|
-
: string
|
|
136
|
-
: never;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Unify a union of objects into a single object.
|
|
140
|
-
* @internal
|
|
141
|
-
*/
|
|
142
|
-
export type UnifyUnion<TUnion> = Simplify<
|
|
143
|
-
(TUnion extends any ? (k: TUnion) => void : never) extends (
|
|
144
|
-
k: infer I,
|
|
145
|
-
) => void
|
|
146
|
-
? I
|
|
147
|
-
: never
|
|
148
|
-
>;
|