sasat 0.22.4 → 0.22.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.
@@ -0,0 +1,64 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_makeCondition = require("../makeCondition-DKSyAkri.cjs");
3
+ //#region src/migration/makeMutaion.ts
4
+ const formatSubscription = (subscription) => {
5
+ if (subscription === void 0 || subscription === false) return {
6
+ enabled: false,
7
+ subscriptionFilter: []
8
+ };
9
+ if (subscription === true) return {
10
+ enabled: true,
11
+ subscriptionFilter: []
12
+ };
13
+ return {
14
+ enabled: subscription.enabled,
15
+ subscriptionFilter: subscription.subscriptionFilter || []
16
+ };
17
+ };
18
+ const formatOptions = (type, option) => ({
19
+ type,
20
+ noReFetch: option?.noRefetch || false,
21
+ middlewares: option?.middlewares || [],
22
+ contextFields: option?.contextFields || [],
23
+ subscription: formatSubscription(option?.subscription)
24
+ });
25
+ const Mutations = {
26
+ create: (options) => formatOptions("create", options),
27
+ update: (options) => formatOptions("update", options),
28
+ delete: (options) => formatOptions("delete", options)
29
+ };
30
+ //#endregion
31
+ //#region src/migration/makeQuery.ts
32
+ const single = (name, options) => ({
33
+ type: "single",
34
+ name,
35
+ conditions: options?.conditions || [],
36
+ middlewares: options?.middlewares || []
37
+ });
38
+ const listAll = (name, options) => ({
39
+ type: "list-all",
40
+ name,
41
+ conditions: options?.conditions || [],
42
+ middlewares: options?.middlewares || []
43
+ });
44
+ const paging = (name, options) => ({
45
+ type: "list-paging",
46
+ name,
47
+ conditions: options?.conditions || [],
48
+ middlewares: options?.middlewares || []
49
+ });
50
+ const primary = (middlewares = []) => ({
51
+ type: "primary",
52
+ conditions: [],
53
+ middlewares
54
+ });
55
+ const Queries = {
56
+ single,
57
+ listAll,
58
+ paging,
59
+ primary
60
+ };
61
+ //#endregion
62
+ exports.Conditions = require_makeCondition.Conditions;
63
+ exports.Mutations = Mutations;
64
+ exports.Queries = Queries;