sfobjects-basic-client 1.1.3 → 1.1.4
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/index.d.ts +10 -1
- package/package.json +1 -1
- package/src/index.ts +12 -2
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,13 @@ type MandatoryCreateProps<O> = {
|
|
|
74
74
|
-readonly [P in K]: O[P];
|
|
75
75
|
}, K>) : never) : never;
|
|
76
76
|
}[KeyOf<O>];
|
|
77
|
+
type UpdateableProps<O> = {
|
|
78
|
+
[K in keyof O]: NonNullable<O[K]> extends SfPrimitiveType ? (IsMutable<{
|
|
79
|
+
[P in K]: O[P];
|
|
80
|
+
}, {
|
|
81
|
+
-readonly [P in K]: O[P];
|
|
82
|
+
}, K>) : never;
|
|
83
|
+
}[KeyOf<O>];
|
|
77
84
|
export type SfRootSelect<OI, N extends KeyOf<OI>> = SfSelect<GetObjectTypes<OI>, OI[N]>;
|
|
78
85
|
export type SfRootWhere<OI, N extends KeyOf<OI>> = SfWhere<GetObjectTypes<OI>, OI[N]>;
|
|
79
86
|
export type SfRootOrderBy<OI, N extends KeyOf<OI>> = SfOrderBy<GetObjectTypes<OI>, OI[N]>;
|
|
@@ -88,7 +95,9 @@ export type SfUpsert<O, K extends MandatoryCreateProps<O>> = SfCreate<O> & {
|
|
|
88
95
|
};
|
|
89
96
|
export type SfUpdate<O> = {
|
|
90
97
|
Id: string;
|
|
91
|
-
} &
|
|
98
|
+
} & {
|
|
99
|
+
[K in UpdateableProps<O>]+?: O[K];
|
|
100
|
+
};
|
|
92
101
|
export type SfObjCfg = {
|
|
93
102
|
objectPrefix: string;
|
|
94
103
|
dateTypes: string[];
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -149,6 +149,16 @@ type MandatoryCreateProps<O> = {
|
|
|
149
149
|
}[KeyOf<O>];
|
|
150
150
|
|
|
151
151
|
|
|
152
|
+
// Update
|
|
153
|
+
|
|
154
|
+
type UpdateableProps<O> = {
|
|
155
|
+
[K in keyof O]: NonNullable<O[K]> extends SfPrimitiveType ? (
|
|
156
|
+
IsMutable<{ [P in K]: O[P] }, { -readonly [P in K]: O[P] }, K>
|
|
157
|
+
) : never
|
|
158
|
+
|
|
159
|
+
}[KeyOf<O>];
|
|
160
|
+
|
|
161
|
+
|
|
152
162
|
|
|
153
163
|
// Select
|
|
154
164
|
|
|
@@ -169,11 +179,11 @@ export type SfCreate<O> = { [K in MandatoryCreateProps<O>]: O[K] } & { [K in Opt
|
|
|
169
179
|
|
|
170
180
|
// Upsert
|
|
171
181
|
|
|
172
|
-
export type SfUpsert<O, K extends MandatoryCreateProps<O
|
|
182
|
+
export type SfUpsert<O, K extends MandatoryCreateProps<O>/* external keys */> = SfCreate<O> & { [P in K]: O[P] };
|
|
173
183
|
|
|
174
184
|
// Update
|
|
175
185
|
|
|
176
|
-
export type SfUpdate<O> = { Id: string } &
|
|
186
|
+
export type SfUpdate<O> = { Id: string } & { [K in UpdateableProps<O>]+?: O[K] };
|
|
177
187
|
|
|
178
188
|
|
|
179
189
|
// Basic Client
|