@pylo/node 0.0.8 → 0.0.9
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 +6 -3
- package/dist/index.js +17 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -136,7 +136,10 @@ interface ListResult<T> {
|
|
|
136
136
|
interface RequestOptions {
|
|
137
137
|
headers?: Record<string, string>;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
interface MutationRequestOptions extends RequestOptions {
|
|
140
|
+
dryRun?: boolean;
|
|
141
|
+
doNotTriggerFlows?: boolean;
|
|
142
|
+
}
|
|
140
143
|
declare class PyloError extends Error {
|
|
141
144
|
graphqlErrors: unknown;
|
|
142
145
|
constructor(message: string, graphqlErrors?: unknown);
|
|
@@ -154,10 +157,10 @@ interface ClientOptions {
|
|
|
154
157
|
interface EntityClient<S, E extends EntityName<S>> {
|
|
155
158
|
list<Sel extends EntitySelect<S, E> | undefined = undefined>(options?: ListOptions<S, E, Sel> & RequestOptions): Promise<ListResult<EntityResult<S, E, Sel>>>;
|
|
156
159
|
byId<Sel extends EntitySelect<S, E> | undefined = undefined>(id: string, options?: ByIdOptions<S, E, Sel> & RequestOptions): Promise<EntityResult<S, E, Sel> | null>;
|
|
157
|
-
upsert(input: UpsertInput<S, E>, options?:
|
|
160
|
+
upsert(input: UpsertInput<S, E>, options?: MutationRequestOptions): Promise<{
|
|
158
161
|
id: string;
|
|
159
162
|
}>;
|
|
160
|
-
delete(ids: string[], options?:
|
|
163
|
+
delete(ids: string[], options?: MutationRequestOptions): Promise<{
|
|
161
164
|
success: boolean;
|
|
162
165
|
}>;
|
|
163
166
|
}
|
package/dist/index.js
CHANGED
|
@@ -234,6 +234,15 @@ function buildDeleteMutation(_entityKey, pascalName, ids) {
|
|
|
234
234
|
variables: { ids }
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
+
var PYLO_DRY_RUN_HEADER = "pylo-dry-run";
|
|
238
|
+
var PYLO_DO_NOT_TRIGGER_FLOWS_HEADER = "pylo-do-not-trigger-flow";
|
|
239
|
+
function flagsToHeaders(flags) {
|
|
240
|
+
if (!flags.dryRun && !flags.doNotTriggerFlows) return void 0;
|
|
241
|
+
const headers = {};
|
|
242
|
+
if (flags.dryRun) headers[PYLO_DRY_RUN_HEADER] = "1";
|
|
243
|
+
if (flags.doNotTriggerFlows) headers[PYLO_DO_NOT_TRIGGER_FLOWS_HEADER] = "1";
|
|
244
|
+
return headers;
|
|
245
|
+
}
|
|
237
246
|
var PyloError = class extends Error {
|
|
238
247
|
constructor(message, graphqlErrors) {
|
|
239
248
|
super(message);
|
|
@@ -318,7 +327,10 @@ function createEntityClient(entityKey, endpoint, metadata, auth, globalHeaders)
|
|
|
318
327
|
query,
|
|
319
328
|
variables,
|
|
320
329
|
auth,
|
|
321
|
-
mergeHeaders(
|
|
330
|
+
mergeHeaders(
|
|
331
|
+
mergeHeaders(globalHeaders, options == null ? void 0 : options.headers),
|
|
332
|
+
flagsToHeaders(options != null ? options : {})
|
|
333
|
+
)
|
|
322
334
|
);
|
|
323
335
|
const mutationKey = `update${entityMeta.pascalName}`;
|
|
324
336
|
const result = data[mutationKey];
|
|
@@ -342,7 +354,10 @@ function createEntityClient(entityKey, endpoint, metadata, auth, globalHeaders)
|
|
|
342
354
|
query,
|
|
343
355
|
variables,
|
|
344
356
|
auth,
|
|
345
|
-
mergeHeaders(
|
|
357
|
+
mergeHeaders(
|
|
358
|
+
mergeHeaders(globalHeaders, options == null ? void 0 : options.headers),
|
|
359
|
+
flagsToHeaders(options != null ? options : {})
|
|
360
|
+
)
|
|
346
361
|
);
|
|
347
362
|
const mutationKey = `delete${entityMeta.pascalName}`;
|
|
348
363
|
const result = data[mutationKey];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pylo/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Server-side Pylo SDK with API key authentication",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/node": "^22.15.21",
|
|
29
29
|
"tsup": "^8.5.1",
|
|
30
30
|
"typescript": "^5.9.3",
|
|
31
|
-
"@pylo/core": "0.0.
|
|
31
|
+
"@pylo/core": "0.0.11",
|
|
32
32
|
"@pylo/auth": "0.0.4"
|
|
33
33
|
},
|
|
34
34
|
"license": "ISC",
|