@edgestore/shared 0.0.0-canary-20260730114359

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 (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/errors/EdgeStoreError.d.ts +47 -0
  4. package/dist/errors/EdgeStoreError.d.ts.map +1 -0
  5. package/dist/errors/EdgeStoreError.js +43 -0
  6. package/dist/errors/index.d.ts +9 -0
  7. package/dist/errors/index.d.ts.map +1 -0
  8. package/dist/errors/index.js +20 -0
  9. package/dist/index.d.ts +8 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +3 -0
  12. package/dist/internals/bucketBuilder.d.ts +315 -0
  13. package/dist/internals/bucketBuilder.d.ts.map +1 -0
  14. package/dist/internals/bucketBuilder.js +230 -0
  15. package/dist/internals/createPathParamProxy.d.ts +21 -0
  16. package/dist/internals/createPathParamProxy.d.ts.map +1 -0
  17. package/dist/internals/createPathParamProxy.js +29 -0
  18. package/dist/internals/providerCapabilities.d.ts +44 -0
  19. package/dist/internals/providerCapabilities.d.ts.map +1 -0
  20. package/dist/internals/providerTypes.d.ts +270 -0
  21. package/dist/internals/providerTypes.d.ts.map +1 -0
  22. package/dist/internals/sharedFuncTypes.d.ts +30 -0
  23. package/dist/internals/sharedFuncTypes.d.ts.map +1 -0
  24. package/dist/internals/types.d.ts +47 -0
  25. package/dist/internals/types.d.ts.map +1 -0
  26. package/dist/types.d.ts +94 -0
  27. package/dist/types.d.ts.map +1 -0
  28. package/package.json +81 -0
  29. package/src/errors/EdgeStoreError.ts +89 -0
  30. package/src/errors/index.ts +14 -0
  31. package/src/index.ts +7 -0
  32. package/src/internals/bucketBuilder.ts +677 -0
  33. package/src/internals/createPathParamProxy.ts +40 -0
  34. package/src/internals/providerCapabilities.ts +126 -0
  35. package/src/internals/providerTypes.ts +388 -0
  36. package/src/internals/sharedFuncTypes.ts +38 -0
  37. package/src/internals/types.ts +52 -0
  38. package/src/types.ts +146 -0
package/src/types.ts ADDED
@@ -0,0 +1,146 @@
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> =
53
+ TType extends PromiseLike<infer U> ? ThenArg<U> : TType;
54
+
55
+ /**
56
+ * @internal
57
+ * @see https://github.com/ianstormtaylor/superstruct/blob/7973400cd04d8ad92bbdc2b6f35acbfb3c934079/src/utils.ts#L323-L325
58
+ */
59
+ export type Simplify<TType> = TType extends any[] | Date
60
+ ? TType
61
+ : { [K in keyof TType]: TType[K] };
62
+
63
+ /**
64
+ * @internal
65
+ */
66
+ export type Prettify<TType> = {
67
+ [K in keyof TType]: TType[K];
68
+ } & {};
69
+
70
+ /**
71
+ * @public
72
+ */
73
+ export type Dict<TType> = Record<string, TType | undefined>;
74
+
75
+ /**
76
+ * @public
77
+ */
78
+ export type MaybePromise<TType> = Promise<TType> | TType;
79
+
80
+ /**
81
+ * @internal
82
+ *
83
+ * Creates a "lower-priority" type inference.
84
+ * https://github.com/microsoft/TypeScript/issues/14829#issuecomment-322267089
85
+ */
86
+ export type InferLast<TType> = TType & {
87
+ [KeyType in keyof TType]: TType[KeyType];
88
+ };
89
+
90
+ /**
91
+ * @public
92
+ */
93
+ export type inferAsyncReturnType<TFunction extends (...args: any) => any> =
94
+ ThenArg<ReturnType<TFunction>>;
95
+
96
+ export type FilterKeys<TObj extends object, TFilter> = {
97
+ [TKey in keyof TObj]: TObj[TKey] extends TFilter ? TKey : never;
98
+ }[keyof TObj];
99
+
100
+ /**
101
+ * @internal
102
+ */
103
+ export type Filter<TObj extends object, TFilter> = Pick<
104
+ TObj,
105
+ FilterKeys<TObj, TFilter>
106
+ >;
107
+
108
+ /**
109
+ * Unwrap return type if the type is a function (sync or async), else uses the type as is
110
+ * @internal
111
+ */
112
+ export type Unwrap<TType> = TType extends (...args: any[]) => infer R
113
+ ? ThenArg<R>
114
+ : TType;
115
+
116
+ /**
117
+ * Makes the object recursively optional.
118
+ * @internal
119
+ */
120
+ export type DeepPartial<TObject> = TObject extends object
121
+ ? {
122
+ [P in keyof TObject]?: DeepPartial<TObject[P]>;
123
+ }
124
+ : TObject;
125
+
126
+ /**
127
+ * Get the keys of a union type.
128
+ * @internal
129
+ */
130
+ export type KeysOfUnion<TUnion> = TUnion extends TUnion
131
+ ? keyof TUnion extends string
132
+ ? keyof TUnion
133
+ : string
134
+ : never;
135
+
136
+ /**
137
+ * Unify a union of objects into a single object.
138
+ * @internal
139
+ */
140
+ export type UnifyUnion<TUnion> = Simplify<
141
+ (TUnion extends any ? (k: TUnion) => void : never) extends (
142
+ k: infer I,
143
+ ) => void
144
+ ? I
145
+ : never
146
+ >;