@foxtware/mineral 0.1.17 → 0.1.18
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/.creds.yml.sample +16 -7
- package/AGENTS.md +3 -0
- package/_build_scripts/publish.js +15 -1
- package/api/backblaze/backblaze.constants.js +11 -0
- package/api/backblaze/backblaze.utils.js +322 -0
- package/api/backblaze/backblazeBucketsGet.js +68 -0
- package/api/backblaze/backblazeFileDelete.js +62 -0
- package/api/backblaze/backblazeFileHide.js +62 -0
- package/api/backblaze/backblazeFileUpload.js +142 -0
- package/api/backblaze/backblazeFilesGet.js +85 -0
- package/api/backblaze/backblazeGet.js +139 -0
- package/api/backblaze/docs.md +6 -0
- package/api/etsy/etsyListingUpdate.js +1 -1
- package/api/gorgias/gorgias.constants.js +8 -0
- package/api/gorgias/gorgias.utils.js +46 -0
- package/api/gorgias/gorgiasAccountGet.js +51 -0
- package/api/gorgias/gorgiasCustomerGet.js +70 -0
- package/api/gorgias/gorgiasCustomersGet.js +56 -0
- package/api/gorgias/gorgiasGet.js +150 -0
- package/api/gorgias/gorgiasGetSingle.js +26 -0
- package/api/gorgias/gorgiasMessagesGet.js +56 -0
- package/api/gorgias/gorgiasTagsGet.js +52 -0
- package/api/gorgias/gorgiasTicketCreate.js +66 -0
- package/api/gorgias/gorgiasTicketGet.js +70 -0
- package/api/gorgias/gorgiasTicketMessageCreate.js +65 -0
- package/api/gorgias/gorgiasTicketMessagesGet.js +66 -0
- package/api/gorgias/gorgiasTicketUpdate.js +62 -0
- package/api/gorgias/gorgiasTicketsGet.js +58 -0
- package/api/gorgias/gorgiasUsersGet.js +52 -0
- package/api/gorgias/gorgiasViewItemsGet.js +57 -0
- package/api/gorgias/gorgiasViewsGet.js +72 -0
- package/api/linear/docs.md +6 -0
- package/api/linear/linear.constants.js +3 -0
- package/api/linear/linear.utils.js +59 -0
- package/api/linear/linearAttachmentCreate.js +77 -0
- package/api/linear/linearAttachmentDelete.js +68 -0
- package/api/linear/linearCommentCreate.js +77 -0
- package/api/linear/linearCommentDelete.js +68 -0
- package/api/linear/linearCommentGet.js +77 -0
- package/api/linear/linearCommentUpdate.js +87 -0
- package/api/linear/linearCommentsGet.js +70 -0
- package/api/linear/linearCyclesGet.js +67 -0
- package/api/linear/linearGet.js +218 -0
- package/api/linear/linearIssueAddLabel.js +77 -0
- package/api/linear/linearIssueArchive.js +74 -0
- package/api/linear/linearIssueCreate.js +94 -0
- package/api/linear/linearIssueDelete.js +74 -0
- package/api/linear/linearIssueGet.js +87 -0
- package/api/linear/linearIssueLabelCreate.js +81 -0
- package/api/linear/linearIssueLabelsGet.js +66 -0
- package/api/linear/linearIssueRemoveLabel.js +77 -0
- package/api/linear/linearIssueUpdate.js +96 -0
- package/api/linear/linearIssuesGet.js +39 -63
- package/api/linear/linearOrganizationGet.js +64 -0
- package/api/linear/linearProjectCreate.js +92 -0
- package/api/linear/linearProjectGet.js +74 -0
- package/api/linear/linearProjectUpdate.js +80 -0
- package/api/linear/linearProjectsGet.js +71 -0
- package/api/linear/linearTeamGet.js +71 -0
- package/api/linear/linearTeamsGet.js +66 -0
- package/api/linear/linearUserGet.js +72 -0
- package/api/linear/linearUsersGet.js +71 -0
- package/api/linear/linearViewerGet.js +65 -0
- package/api/linear/linearWebhookCreate.js +77 -0
- package/api/linear/linearWebhookDelete.js +68 -0
- package/api/linear/linearWebhooksGet.js +67 -0
- package/api/linear/linearWorkflowStatesGet.js +73 -0
- package/api/pipe17/pipe17.utils.js +7 -20
- package/api/pipe17/pipe17ArrivalGet.js +1 -1
- package/api/pipe17/pipe17FulfillmentGet.js +1 -1
- package/api/pipe17/pipe17InventoryItemGet.js +1 -1
- package/api/pipe17/pipe17JobGet.js +11 -24
- package/api/pipe17/pipe17LocationGet.js +1 -1
- package/api/pipe17/pipe17OrderGet.js +1 -1
- package/api/pipe17/pipe17ProductGet.js +1 -1
- package/api/pipe17/pipe17PurchaseGet.js +1 -1
- package/api/pipe17/pipe17ReceiptGet.js +1 -1
- package/api/pipe17/pipe17ReturnGet.js +1 -1
- package/api/shopify/shopifyFileCreate.js +107 -0
- package/api/shopify/shopifyMetafieldDefinitionCreate.js +2 -0
- package/api/shopify/shopifyMetafieldDefinitionGet.js +108 -0
- package/api/shopify/shopifyMetafieldDefinitionPropagate.js +27 -71
- package/api/shopify/shopifyThemeFileGet.js +112 -0
- package/api/shopify/shopifyThemeFilePropagate.js +410 -0
- package/api/shopify/shopifyThemeFilesUpsert.js +88 -0
- package/api/starshipit/starshipit.utils.js +1 -0
- package/api/starshipit/starshipitOrderGet.js +2 -10
- package/api/utils.js +12 -4
- package/package.json +1 -1
- package/server.utils.js +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, valueProvided } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['id'],
|
|
10
|
+
['input', valueProvided],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const linearCommentUpdate = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
id,
|
|
16
|
+
input,
|
|
17
|
+
{
|
|
18
|
+
skipEditedAt,
|
|
19
|
+
inspect = false,
|
|
20
|
+
fetchClient = linearClient,
|
|
21
|
+
} = {},
|
|
22
|
+
) => {
|
|
23
|
+
|
|
24
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
25
|
+
credsPayload,
|
|
26
|
+
id,
|
|
27
|
+
input,
|
|
28
|
+
});
|
|
29
|
+
if (rejectResponse) {
|
|
30
|
+
return rejectResponse;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return fetchClient.fetch({
|
|
34
|
+
requestPayload: {
|
|
35
|
+
body: {
|
|
36
|
+
query: `
|
|
37
|
+
mutation CommentUpdate(
|
|
38
|
+
$id: String!
|
|
39
|
+
$input: CommentUpdateInput!
|
|
40
|
+
$skipEditedAt: Boolean
|
|
41
|
+
) {
|
|
42
|
+
commentUpdate(id: $id, input: $input, skipEditedAt: $skipEditedAt) {
|
|
43
|
+
success
|
|
44
|
+
comment {
|
|
45
|
+
id
|
|
46
|
+
body
|
|
47
|
+
createdAt
|
|
48
|
+
updatedAt
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
variables: {
|
|
54
|
+
id,
|
|
55
|
+
input,
|
|
56
|
+
skipEditedAt,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
context: {
|
|
61
|
+
credsPayload,
|
|
62
|
+
resultPath: 'data.commentUpdate',
|
|
63
|
+
},
|
|
64
|
+
inspect,
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const funcApiConfig = {
|
|
69
|
+
argsWarden,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
module.exports = {
|
|
73
|
+
linearCommentUpdate,
|
|
74
|
+
funcApiConfig,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
curl -X POST "http://localhost:8000/linearCommentUpdate" \
|
|
79
|
+
-H "Content-Type: application/json" \
|
|
80
|
+
-d '{
|
|
81
|
+
"credsPayload": { "credsPath": "linear" },
|
|
82
|
+
"id": "COMMENT_ID",
|
|
83
|
+
"input": {
|
|
84
|
+
"body": "Updated"
|
|
85
|
+
}
|
|
86
|
+
}'
|
|
87
|
+
*/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearGet, linearGetter } = require('./linearGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const linearCommentsGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
attrs = `
|
|
17
|
+
id
|
|
18
|
+
body
|
|
19
|
+
createdAt
|
|
20
|
+
updatedAt
|
|
21
|
+
user {
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
...getterOptions
|
|
27
|
+
} = {},
|
|
28
|
+
) => {
|
|
29
|
+
|
|
30
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
31
|
+
credsPayload,
|
|
32
|
+
});
|
|
33
|
+
if (rejectResponse) {
|
|
34
|
+
return rejectResponse;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const getterArgs = [
|
|
38
|
+
credsPayload,
|
|
39
|
+
'comment',
|
|
40
|
+
{
|
|
41
|
+
attrs,
|
|
42
|
+
...getterOptions,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
return returnGetter
|
|
47
|
+
? linearGetter(...getterArgs)
|
|
48
|
+
: linearGet(...getterArgs);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const funcApiConfig = {
|
|
52
|
+
argsWarden,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
linearCommentsGet: linearCommentsGet.bind(null, false),
|
|
57
|
+
linearCommentsGetter: linearCommentsGet.bind(null, true),
|
|
58
|
+
funcApiConfig,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
curl -X POST "http://localhost:8000/linearCommentsGet" \
|
|
63
|
+
-H "Content-Type: application/json" \
|
|
64
|
+
-d '{
|
|
65
|
+
"credsPayload": { "credsPath": "linear" },
|
|
66
|
+
"options": {
|
|
67
|
+
"limit": 10
|
|
68
|
+
}
|
|
69
|
+
}'
|
|
70
|
+
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearGet, linearGetter } = require('./linearGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const linearCyclesGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
attrs = `
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
number
|
|
20
|
+
startsAt
|
|
21
|
+
endsAt
|
|
22
|
+
`,
|
|
23
|
+
...getterOptions
|
|
24
|
+
} = {},
|
|
25
|
+
) => {
|
|
26
|
+
|
|
27
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
28
|
+
credsPayload,
|
|
29
|
+
});
|
|
30
|
+
if (rejectResponse) {
|
|
31
|
+
return rejectResponse;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const getterArgs = [
|
|
35
|
+
credsPayload,
|
|
36
|
+
'cycle',
|
|
37
|
+
{
|
|
38
|
+
attrs,
|
|
39
|
+
...getterOptions,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
return returnGetter
|
|
44
|
+
? linearGetter(...getterArgs)
|
|
45
|
+
: linearGet(...getterArgs);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const funcApiConfig = {
|
|
49
|
+
argsWarden,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
linearCyclesGet: linearCyclesGet.bind(null, false),
|
|
54
|
+
linearCyclesGetter: linearCyclesGet.bind(null, true),
|
|
55
|
+
funcApiConfig,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
curl -X POST "http://localhost:8000/linearCyclesGet" \
|
|
60
|
+
-H "Content-Type: application/json" \
|
|
61
|
+
-d '{
|
|
62
|
+
"credsPayload": { "credsPath": "linear" },
|
|
63
|
+
"options": {
|
|
64
|
+
"limit": 5
|
|
65
|
+
}
|
|
66
|
+
}'
|
|
67
|
+
*/
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, Getter, capitaliseString } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { MAX_PER_PAGE } = require('../linear/linear.constants');
|
|
6
|
+
const {
|
|
7
|
+
linearClient,
|
|
8
|
+
linearConnectionDigester,
|
|
9
|
+
linearConnectionPaginator,
|
|
10
|
+
} = require('../linear/linear.utils');
|
|
11
|
+
|
|
12
|
+
const argsWarden = new ArgsWarden([
|
|
13
|
+
['credsPayload', credsValidator],
|
|
14
|
+
['resource'],
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
const linearGetPacket = async (
|
|
18
|
+
credsPayload,
|
|
19
|
+
resource,
|
|
20
|
+
resources,
|
|
21
|
+
attrs,
|
|
22
|
+
{
|
|
23
|
+
filter,
|
|
24
|
+
filterType,
|
|
25
|
+
before,
|
|
26
|
+
after,
|
|
27
|
+
last,
|
|
28
|
+
includeArchived,
|
|
29
|
+
orderBy,
|
|
30
|
+
sort,
|
|
31
|
+
sortType,
|
|
32
|
+
includeDisabled,
|
|
33
|
+
supportsIncludeDisabled = false,
|
|
34
|
+
perPage = MAX_PER_PAGE,
|
|
35
|
+
inspect = false,
|
|
36
|
+
fetchClient = linearClient,
|
|
37
|
+
} = {},
|
|
38
|
+
) => {
|
|
39
|
+
const Resource = capitaliseString(resource);
|
|
40
|
+
const Resources = capitaliseString(resources);
|
|
41
|
+
const resolvedFilterType = filterType === undefined
|
|
42
|
+
? `${ Resource }Filter`
|
|
43
|
+
: filterType;
|
|
44
|
+
const resolvedSortType = sortType === true
|
|
45
|
+
? `${ Resource }SortInput`
|
|
46
|
+
: sortType;
|
|
47
|
+
const includeFilter = Boolean(resolvedFilterType);
|
|
48
|
+
const includeSort = Boolean(resolvedSortType);
|
|
49
|
+
const includeIncludeDisabled = supportsIncludeDisabled || includeDisabled !== undefined;
|
|
50
|
+
|
|
51
|
+
const queryTypeDeclaration = [
|
|
52
|
+
...includeFilter ? [`$filter: ${ resolvedFilterType }`] : [],
|
|
53
|
+
...includeIncludeDisabled ? ['$includeDisabled: Boolean'] : [],
|
|
54
|
+
'$before: String',
|
|
55
|
+
'$after: String',
|
|
56
|
+
'$first: Int',
|
|
57
|
+
'$last: Int',
|
|
58
|
+
'$includeArchived: Boolean',
|
|
59
|
+
'$orderBy: PaginationOrderBy',
|
|
60
|
+
...includeSort ? [`$sort: [${ resolvedSortType }!]`] : [],
|
|
61
|
+
].join('\n');
|
|
62
|
+
|
|
63
|
+
const queryVariableDeclaration = [
|
|
64
|
+
...includeFilter ? ['filter: $filter'] : [],
|
|
65
|
+
...includeIncludeDisabled ? ['includeDisabled: $includeDisabled'] : [],
|
|
66
|
+
'before: $before',
|
|
67
|
+
'after: $after',
|
|
68
|
+
'first: $first',
|
|
69
|
+
'last: $last',
|
|
70
|
+
'includeArchived: $includeArchived',
|
|
71
|
+
'orderBy: $orderBy',
|
|
72
|
+
...includeSort ? ['sort: $sort'] : [],
|
|
73
|
+
].join('\n');
|
|
74
|
+
|
|
75
|
+
return fetchClient.fetch({
|
|
76
|
+
requestPayload: {
|
|
77
|
+
body: {
|
|
78
|
+
query: `
|
|
79
|
+
query ${ Resources }Get(
|
|
80
|
+
${ queryTypeDeclaration }
|
|
81
|
+
) {
|
|
82
|
+
${ resources }(
|
|
83
|
+
${ queryVariableDeclaration }
|
|
84
|
+
) {
|
|
85
|
+
nodes {
|
|
86
|
+
${ attrs }
|
|
87
|
+
}
|
|
88
|
+
pageInfo {
|
|
89
|
+
hasNextPage
|
|
90
|
+
endCursor
|
|
91
|
+
hasPreviousPage
|
|
92
|
+
startCursor
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`,
|
|
97
|
+
variables: {
|
|
98
|
+
...includeFilter && { filter },
|
|
99
|
+
...includeIncludeDisabled && { includeDisabled },
|
|
100
|
+
before,
|
|
101
|
+
after,
|
|
102
|
+
first: Math.min(perPage, MAX_PER_PAGE),
|
|
103
|
+
last,
|
|
104
|
+
includeArchived,
|
|
105
|
+
orderBy,
|
|
106
|
+
...includeSort && { sort },
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
context: {
|
|
111
|
+
credsPayload,
|
|
112
|
+
resultPath: `data.${ resources }`,
|
|
113
|
+
},
|
|
114
|
+
inspect,
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const linearGet = async (
|
|
119
|
+
returnGetter, // Always bound
|
|
120
|
+
|
|
121
|
+
credsPayload,
|
|
122
|
+
resource,
|
|
123
|
+
{
|
|
124
|
+
attrs = 'id',
|
|
125
|
+
resources = `${ resource }s`,
|
|
126
|
+
filter,
|
|
127
|
+
filterType,
|
|
128
|
+
before,
|
|
129
|
+
after,
|
|
130
|
+
last,
|
|
131
|
+
includeArchived,
|
|
132
|
+
orderBy,
|
|
133
|
+
sort,
|
|
134
|
+
sortType,
|
|
135
|
+
includeDisabled,
|
|
136
|
+
supportsIncludeDisabled = false,
|
|
137
|
+
perPage = MAX_PER_PAGE,
|
|
138
|
+
inspect = false,
|
|
139
|
+
...getterOptions
|
|
140
|
+
} = {},
|
|
141
|
+
) => {
|
|
142
|
+
|
|
143
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
144
|
+
credsPayload,
|
|
145
|
+
resource,
|
|
146
|
+
});
|
|
147
|
+
if (rejectResponse) {
|
|
148
|
+
return rejectResponse;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const getter = new Getter(
|
|
152
|
+
{
|
|
153
|
+
args: [
|
|
154
|
+
credsPayload,
|
|
155
|
+
resource,
|
|
156
|
+
resources,
|
|
157
|
+
attrs,
|
|
158
|
+
],
|
|
159
|
+
options: {
|
|
160
|
+
filter,
|
|
161
|
+
filterType,
|
|
162
|
+
before,
|
|
163
|
+
after,
|
|
164
|
+
last,
|
|
165
|
+
includeArchived,
|
|
166
|
+
orderBy,
|
|
167
|
+
sort,
|
|
168
|
+
sortType,
|
|
169
|
+
includeDisabled,
|
|
170
|
+
supportsIncludeDisabled,
|
|
171
|
+
perPage,
|
|
172
|
+
inspect,
|
|
173
|
+
...getterOptions,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
func: linearGetPacket,
|
|
178
|
+
digester: linearConnectionDigester,
|
|
179
|
+
paginator: linearConnectionPaginator,
|
|
180
|
+
...getterOptions,
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
if (returnGetter) {
|
|
185
|
+
return getter;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const data = await getter.run({ returnAll: true });
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
ok: true,
|
|
192
|
+
data,
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const funcApiConfig = {
|
|
197
|
+
argsWarden,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
module.exports = {
|
|
201
|
+
linearGet: linearGet.bind(null, false),
|
|
202
|
+
linearGetter: linearGet.bind(null, true),
|
|
203
|
+
funcApiConfig,
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/*
|
|
207
|
+
curl -X POST "http://localhost:8000/linearGet" \
|
|
208
|
+
-H "Content-Type: application/json" \
|
|
209
|
+
-d '{
|
|
210
|
+
"credsPayload": { "credsPath": "linear" },
|
|
211
|
+
"resource": "issue",
|
|
212
|
+
"options": {
|
|
213
|
+
"limit": 5,
|
|
214
|
+
"attrs": "id identifier title",
|
|
215
|
+
"sortType": true
|
|
216
|
+
}
|
|
217
|
+
}'
|
|
218
|
+
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['id'],
|
|
10
|
+
['labelId'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const linearIssueAddLabel = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
id,
|
|
16
|
+
labelId,
|
|
17
|
+
{
|
|
18
|
+
inspect = false,
|
|
19
|
+
fetchClient = linearClient,
|
|
20
|
+
} = {},
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
id,
|
|
26
|
+
labelId,
|
|
27
|
+
});
|
|
28
|
+
if (rejectResponse) {
|
|
29
|
+
return rejectResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return fetchClient.fetch({
|
|
33
|
+
requestPayload: {
|
|
34
|
+
body: {
|
|
35
|
+
query: `
|
|
36
|
+
mutation IssueAddLabel($id: String!, $labelId: String!) {
|
|
37
|
+
issueAddLabel(id: $id, labelId: $labelId) {
|
|
38
|
+
success
|
|
39
|
+
issue {
|
|
40
|
+
id
|
|
41
|
+
identifier
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
variables: {
|
|
47
|
+
id,
|
|
48
|
+
labelId,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
context: {
|
|
53
|
+
credsPayload,
|
|
54
|
+
resultPath: 'data.issueAddLabel',
|
|
55
|
+
},
|
|
56
|
+
inspect,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const funcApiConfig = {
|
|
61
|
+
argsWarden,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
linearIssueAddLabel,
|
|
66
|
+
funcApiConfig,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
curl -X POST "http://localhost:8000/linearIssueAddLabel" \
|
|
71
|
+
-H "Content-Type: application/json" \
|
|
72
|
+
-d '{
|
|
73
|
+
"credsPayload": { "credsPath": "linear" },
|
|
74
|
+
"id": "WHI-267",
|
|
75
|
+
"labelId": "LABEL_ID"
|
|
76
|
+
}'
|
|
77
|
+
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['id'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearIssueArchive = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
id,
|
|
15
|
+
{
|
|
16
|
+
trash,
|
|
17
|
+
inspect = false,
|
|
18
|
+
fetchClient = linearClient,
|
|
19
|
+
} = {},
|
|
20
|
+
) => {
|
|
21
|
+
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
id,
|
|
25
|
+
});
|
|
26
|
+
if (rejectResponse) {
|
|
27
|
+
return rejectResponse;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return fetchClient.fetch({
|
|
31
|
+
requestPayload: {
|
|
32
|
+
body: {
|
|
33
|
+
query: `
|
|
34
|
+
mutation IssueArchive($id: String!, $trash: Boolean) {
|
|
35
|
+
issueArchive(id: $id, trash: $trash) {
|
|
36
|
+
success
|
|
37
|
+
entity {
|
|
38
|
+
id
|
|
39
|
+
identifier
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
variables: {
|
|
45
|
+
id,
|
|
46
|
+
trash,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
context: {
|
|
51
|
+
credsPayload,
|
|
52
|
+
resultPath: 'data.issueArchive',
|
|
53
|
+
},
|
|
54
|
+
inspect,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const funcApiConfig = {
|
|
59
|
+
argsWarden,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
module.exports = {
|
|
63
|
+
linearIssueArchive,
|
|
64
|
+
funcApiConfig,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
curl -X POST "http://localhost:8000/linearIssueArchive" \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{
|
|
71
|
+
"credsPayload": { "credsPath": "linear" },
|
|
72
|
+
"id": "WHI-267"
|
|
73
|
+
}'
|
|
74
|
+
*/
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const inputValidator = (input) => Boolean(input?.title && input?.teamId);
|
|
8
|
+
|
|
9
|
+
const argsWarden = new ArgsWarden([
|
|
10
|
+
['credsPayload', credsValidator],
|
|
11
|
+
['input', inputValidator],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const linearIssueCreate = async (
|
|
15
|
+
credsPayload,
|
|
16
|
+
input,
|
|
17
|
+
{
|
|
18
|
+
inspect = false,
|
|
19
|
+
fetchClient = linearClient,
|
|
20
|
+
} = {},
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
input,
|
|
26
|
+
});
|
|
27
|
+
if (rejectResponse) {
|
|
28
|
+
return rejectResponse;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return fetchClient.fetch({
|
|
32
|
+
requestPayload: {
|
|
33
|
+
body: {
|
|
34
|
+
query: `
|
|
35
|
+
mutation IssueCreate($input: IssueCreateInput!) {
|
|
36
|
+
issueCreate(input: $input) {
|
|
37
|
+
success
|
|
38
|
+
issue {
|
|
39
|
+
id
|
|
40
|
+
identifier
|
|
41
|
+
title
|
|
42
|
+
url
|
|
43
|
+
priority
|
|
44
|
+
createdAt
|
|
45
|
+
updatedAt
|
|
46
|
+
state {
|
|
47
|
+
id
|
|
48
|
+
name
|
|
49
|
+
}
|
|
50
|
+
team {
|
|
51
|
+
id
|
|
52
|
+
name
|
|
53
|
+
}
|
|
54
|
+
assignee {
|
|
55
|
+
id
|
|
56
|
+
name
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
variables: {
|
|
63
|
+
input,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
context: {
|
|
68
|
+
credsPayload,
|
|
69
|
+
resultPath: 'data.issueCreate',
|
|
70
|
+
},
|
|
71
|
+
inspect,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const funcApiConfig = {
|
|
76
|
+
argsWarden,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
module.exports = {
|
|
80
|
+
linearIssueCreate,
|
|
81
|
+
funcApiConfig,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
curl -X POST "http://localhost:8000/linearIssueCreate" \
|
|
86
|
+
-H "Content-Type: application/json" \
|
|
87
|
+
-d '{
|
|
88
|
+
"credsPayload": { "credsPath": "linear" },
|
|
89
|
+
"input": {
|
|
90
|
+
"title": "Example issue",
|
|
91
|
+
"teamId": "f2387dcd-61ac-49aa-8d7a-7f62a0b5cca0"
|
|
92
|
+
}
|
|
93
|
+
}'
|
|
94
|
+
*/
|