fluidattacks_timedoctor_sdk 5.2.2__tar.gz → 6.0.0__tar.gz
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.
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/PKG-INFO +3 -3
- fluidattacks_timedoctor_sdk-6.0.0/build/default.nix +13 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/flake.lock +47 -81
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/flake.nix +5 -4
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/__init__.py +1 -1
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/auth/_new_token.py +9 -5
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/auth/_revoke.py +5 -3
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/__init__.py +4 -1
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_common.py +38 -34
- fluidattacks_timedoctor_sdk-6.0.0/fluidattacks_timedoctor_sdk/client/_computer_activity/__init__.py +6 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_computer_activity/_decode.py +10 -10
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_computer_activity/_get.py +59 -74
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_get_companies.py +19 -24
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_get_projects.py +35 -45
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_get_users.py +20 -27
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_worklog/_decode.py +16 -18
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_worklog/_get.py +38 -32
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/core.py +5 -17
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/pyproject.toml +7 -3
- fluidattacks_timedoctor_sdk-6.0.0/ruff.toml +55 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/arch/arch.py +3 -5
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/arch/test_arch.py +2 -2
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/client/test_decode_worklog.py +9 -6
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/client/test_ignore_no_task.py +9 -6
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests_fx/test_api.py +20 -20
- fluidattacks_timedoctor_sdk-6.0.0/uv.lock +742 -0
- fluidattacks_timedoctor_sdk-5.2.2/build/default.nix +0 -13
- fluidattacks_timedoctor_sdk-5.2.2/fluidattacks_timedoctor_sdk/client/_computer_activity/__init__.py +0 -5
- fluidattacks_timedoctor_sdk-5.2.2/uv.lock +0 -1506
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/.envrc +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/build/filter.nix +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/_logger.py +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/auth/__init__.py +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/auth/_core.py +3 -3
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/client/_worklog/__init__.py +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/fluidattacks_timedoctor_sdk/py.typed +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/mypy.ini +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/__init__.py +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/arch/__init__.py +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/client/__init__.py +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests/py.typed +0 -0
- {fluidattacks_timedoctor_sdk-5.2.2 → fluidattacks_timedoctor_sdk-6.0.0}/tests_fx/__init__.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fluidattacks_timedoctor_sdk
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.0
|
|
4
4
|
Summary: timedoctor SDK
|
|
5
5
|
Author-email: Product Team <development@fluidattacks.com>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.13.14, <3.14
|
|
7
7
|
Requires-Dist: click >=8.3.0, <9.0.0
|
|
8
8
|
Requires-Dist: fluidattacks-etl-utils >=4.0.0, <5.0.0
|
|
9
9
|
Requires-Dist: fa-purity >=2.5.2, <3.0.0
|
|
10
10
|
Requires-Dist: pure-requests >=3.0.0, <4.0.0
|
|
11
11
|
Requires-Dist: python-dateutil >=2.8.0, <3.0.0
|
|
12
|
-
Requires-Dist: fluidattacks-utils-logger >=3.0.
|
|
12
|
+
Requires-Dist: fluidattacks-utils-logger >=3.0.5, <4.0.0
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"nixpkgs-lib": "nixpkgs-lib"
|
|
6
6
|
},
|
|
7
7
|
"locked": {
|
|
8
|
-
"lastModified":
|
|
9
|
-
"narHash": "sha256-
|
|
8
|
+
"lastModified": 1768135262,
|
|
9
|
+
"narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=",
|
|
10
10
|
"owner": "hercules-ci",
|
|
11
11
|
"repo": "flake-parts",
|
|
12
|
-
"rev": "
|
|
12
|
+
"rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac",
|
|
13
13
|
"type": "github"
|
|
14
14
|
},
|
|
15
15
|
"original": {
|
|
@@ -35,27 +35,27 @@
|
|
|
35
35
|
},
|
|
36
36
|
"nixpkgs": {
|
|
37
37
|
"locked": {
|
|
38
|
-
"lastModified":
|
|
39
|
-
"narHash": "sha256-
|
|
38
|
+
"lastModified": 1785133411,
|
|
39
|
+
"narHash": "sha256-Yjv0WEg39KRYS0rBdTbu6Fc/or/ihAKk13W9sQ6VWd0=",
|
|
40
40
|
"owner": "nixos",
|
|
41
41
|
"repo": "nixpkgs",
|
|
42
|
-
"rev": "
|
|
42
|
+
"rev": "2f5a153c270b70cb0f8c11f46d96d6d3bc39f4e3",
|
|
43
43
|
"type": "github"
|
|
44
44
|
},
|
|
45
45
|
"original": {
|
|
46
46
|
"owner": "nixos",
|
|
47
|
-
"ref": "nixos-unstable",
|
|
48
47
|
"repo": "nixpkgs",
|
|
48
|
+
"rev": "2f5a153c270b70cb0f8c11f46d96d6d3bc39f4e3",
|
|
49
49
|
"type": "github"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"nixpkgs-lib": {
|
|
53
53
|
"locked": {
|
|
54
|
-
"lastModified":
|
|
55
|
-
"narHash": "sha256-
|
|
54
|
+
"lastModified": 1765674936,
|
|
55
|
+
"narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
|
|
56
56
|
"owner": "nix-community",
|
|
57
57
|
"repo": "nixpkgs.lib",
|
|
58
|
-
"rev": "
|
|
58
|
+
"rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
|
|
59
59
|
"type": "github"
|
|
60
60
|
},
|
|
61
61
|
"original": {
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
},
|
|
83
83
|
"nixpkgs_3": {
|
|
84
84
|
"locked": {
|
|
85
|
-
"lastModified":
|
|
86
|
-
"narHash": "sha256-
|
|
85
|
+
"lastModified": 1758690382,
|
|
86
|
+
"narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
|
|
87
87
|
"owner": "nixos",
|
|
88
88
|
"repo": "nixpkgs",
|
|
89
|
-
"rev": "
|
|
89
|
+
"rev": "e643668fd71b949c53f8626614b21ff71a07379d",
|
|
90
90
|
"type": "github"
|
|
91
91
|
},
|
|
92
92
|
"original": {
|
|
@@ -96,67 +96,25 @@
|
|
|
96
96
|
"type": "github"
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
|
-
"
|
|
99
|
+
"nixpkgs_4": {
|
|
100
100
|
"locked": {
|
|
101
|
-
"lastModified":
|
|
102
|
-
"narHash": "sha256-
|
|
103
|
-
"owner": "nixos",
|
|
104
|
-
"repo": "nixpkgs",
|
|
105
|
-
"rev": "400156fe527ab6b54cf6f70cca2c8385548a29c4",
|
|
106
|
-
"type": "github"
|
|
107
|
-
},
|
|
108
|
-
"original": {
|
|
109
|
-
"owner": "nixos",
|
|
110
|
-
"repo": "nixpkgs",
|
|
111
|
-
"type": "github"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"nixpkgs_flake_2": {
|
|
115
|
-
"locked": {
|
|
116
|
-
"lastModified": 1761668286,
|
|
117
|
-
"narHash": "sha256-YN/cm/hbm7pi7lMZCsNhu6jlBUi4wUirrIlyOMpbjKU=",
|
|
101
|
+
"lastModified": 1761373498,
|
|
102
|
+
"narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=",
|
|
118
103
|
"owner": "nixos",
|
|
119
104
|
"repo": "nixpkgs",
|
|
120
|
-
"rev": "
|
|
105
|
+
"rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce",
|
|
121
106
|
"type": "github"
|
|
122
107
|
},
|
|
123
108
|
"original": {
|
|
124
109
|
"owner": "nixos",
|
|
110
|
+
"ref": "nixos-unstable",
|
|
125
111
|
"repo": "nixpkgs",
|
|
126
112
|
"type": "github"
|
|
127
113
|
}
|
|
128
114
|
},
|
|
129
|
-
"observes_flake_builder": {
|
|
130
|
-
"inputs": {
|
|
131
|
-
"nix_filter": "nix_filter",
|
|
132
|
-
"nixpkgs_flake": "nixpkgs_flake",
|
|
133
|
-
"pyproject-build-systems": "pyproject-build-systems",
|
|
134
|
-
"pyproject-nix": "pyproject-nix_2",
|
|
135
|
-
"pythonix_flake": "pythonix_flake",
|
|
136
|
-
"shell-helpers": "shell-helpers",
|
|
137
|
-
"uv2nix": "uv2nix_2"
|
|
138
|
-
},
|
|
139
|
-
"locked": {
|
|
140
|
-
"dir": "observes/common/std_flake_2",
|
|
141
|
-
"lastModified": 1772468695,
|
|
142
|
-
"narHash": "sha256-xCjSBFmyt42HMor32KWftZvGmkZIQqrMw/wZBDmwUR4=",
|
|
143
|
-
"ref": "refs/heads/trunk",
|
|
144
|
-
"rev": "2ec9c61f8d8dfe8e8ba3a80b12577ec88c3bc7cb",
|
|
145
|
-
"shallow": true,
|
|
146
|
-
"type": "git",
|
|
147
|
-
"url": "ssh://git@gitlab.com/fluidattacks/universe"
|
|
148
|
-
},
|
|
149
|
-
"original": {
|
|
150
|
-
"dir": "observes/common/std_flake_2",
|
|
151
|
-
"rev": "2ec9c61f8d8dfe8e8ba3a80b12577ec88c3bc7cb",
|
|
152
|
-
"shallow": true,
|
|
153
|
-
"type": "git",
|
|
154
|
-
"url": "ssh://git@gitlab.com/fluidattacks/universe"
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
115
|
"pyproject-build-systems": {
|
|
158
116
|
"inputs": {
|
|
159
|
-
"nixpkgs": "
|
|
117
|
+
"nixpkgs": "nixpkgs_2",
|
|
160
118
|
"pyproject-nix": "pyproject-nix",
|
|
161
119
|
"uv2nix": "uv2nix"
|
|
162
120
|
},
|
|
@@ -177,7 +135,7 @@
|
|
|
177
135
|
"pyproject-nix": {
|
|
178
136
|
"inputs": {
|
|
179
137
|
"nixpkgs": [
|
|
180
|
-
"
|
|
138
|
+
"python_builder",
|
|
181
139
|
"pyproject-build-systems",
|
|
182
140
|
"nixpkgs"
|
|
183
141
|
]
|
|
@@ -198,7 +156,7 @@
|
|
|
198
156
|
},
|
|
199
157
|
"pyproject-nix_2": {
|
|
200
158
|
"inputs": {
|
|
201
|
-
"nixpkgs": "
|
|
159
|
+
"nixpkgs": "nixpkgs_3"
|
|
202
160
|
},
|
|
203
161
|
"locked": {
|
|
204
162
|
"lastModified": 1762427963,
|
|
@@ -217,7 +175,7 @@
|
|
|
217
175
|
"pyproject-nix_3": {
|
|
218
176
|
"inputs": {
|
|
219
177
|
"nixpkgs": [
|
|
220
|
-
"
|
|
178
|
+
"python_builder",
|
|
221
179
|
"uv2nix",
|
|
222
180
|
"nixpkgs"
|
|
223
181
|
]
|
|
@@ -236,23 +194,30 @@
|
|
|
236
194
|
"type": "github"
|
|
237
195
|
}
|
|
238
196
|
},
|
|
239
|
-
"
|
|
197
|
+
"python_builder": {
|
|
240
198
|
"inputs": {
|
|
241
|
-
"
|
|
199
|
+
"nix_filter": "nix_filter",
|
|
200
|
+
"nixpkgs_flake": [
|
|
201
|
+
"nixpkgs"
|
|
202
|
+
],
|
|
203
|
+
"pyproject-build-systems": "pyproject-build-systems",
|
|
204
|
+
"pyproject-nix": "pyproject-nix_2",
|
|
205
|
+
"shell-helpers": "shell-helpers",
|
|
206
|
+
"uv2nix": "uv2nix_2"
|
|
242
207
|
},
|
|
243
208
|
"locked": {
|
|
244
|
-
"dir": "
|
|
245
|
-
"lastModified":
|
|
246
|
-
"narHash": "sha256-
|
|
209
|
+
"dir": "common/utils/python-builder",
|
|
210
|
+
"lastModified": 1787753967,
|
|
211
|
+
"narHash": "sha256-1kWAiANGMA4B9flxHFj73EwvOpF8r0nXGg1RVXNKPK8=",
|
|
247
212
|
"ref": "refs/heads/trunk",
|
|
248
|
-
"rev": "
|
|
213
|
+
"rev": "2490a24f91f075f7580cd0b9df5bc01dbc467a50",
|
|
249
214
|
"shallow": true,
|
|
250
215
|
"type": "git",
|
|
251
216
|
"url": "ssh://git@gitlab.com/fluidattacks/universe"
|
|
252
217
|
},
|
|
253
218
|
"original": {
|
|
254
|
-
"dir": "
|
|
255
|
-
"rev": "
|
|
219
|
+
"dir": "common/utils/python-builder",
|
|
220
|
+
"rev": "2490a24f91f075f7580cd0b9df5bc01dbc467a50",
|
|
256
221
|
"shallow": true,
|
|
257
222
|
"type": "git",
|
|
258
223
|
"url": "ssh://git@gitlab.com/fluidattacks/universe"
|
|
@@ -260,30 +225,31 @@
|
|
|
260
225
|
},
|
|
261
226
|
"root": {
|
|
262
227
|
"inputs": {
|
|
263
|
-
"
|
|
228
|
+
"nixpkgs": "nixpkgs",
|
|
229
|
+
"python_builder": "python_builder"
|
|
264
230
|
}
|
|
265
231
|
},
|
|
266
232
|
"shell-helpers": {
|
|
267
233
|
"inputs": {
|
|
268
234
|
"flake-parts": "flake-parts",
|
|
269
235
|
"nixpkgs": [
|
|
270
|
-
"
|
|
236
|
+
"python_builder",
|
|
271
237
|
"nixpkgs_flake"
|
|
272
238
|
]
|
|
273
239
|
},
|
|
274
240
|
"locked": {
|
|
275
241
|
"dir": "common/utils/shell-helpers",
|
|
276
|
-
"lastModified":
|
|
277
|
-
"narHash": "sha256-
|
|
242
|
+
"lastModified": 1787145059,
|
|
243
|
+
"narHash": "sha256-i5i+qLR9JhcNasrQvzG4S/0AotpZAqTHXa4/68MmvwA=",
|
|
278
244
|
"ref": "refs/heads/trunk",
|
|
279
|
-
"rev": "
|
|
245
|
+
"rev": "e0d58302690af6f38b7544265e59c625b63df76f",
|
|
280
246
|
"shallow": true,
|
|
281
247
|
"type": "git",
|
|
282
248
|
"url": "ssh://git@gitlab.com/fluidattacks/universe"
|
|
283
249
|
},
|
|
284
250
|
"original": {
|
|
285
251
|
"dir": "common/utils/shell-helpers",
|
|
286
|
-
"rev": "
|
|
252
|
+
"rev": "e0d58302690af6f38b7544265e59c625b63df76f",
|
|
287
253
|
"shallow": true,
|
|
288
254
|
"type": "git",
|
|
289
255
|
"url": "ssh://git@gitlab.com/fluidattacks/universe"
|
|
@@ -292,12 +258,12 @@
|
|
|
292
258
|
"uv2nix": {
|
|
293
259
|
"inputs": {
|
|
294
260
|
"nixpkgs": [
|
|
295
|
-
"
|
|
261
|
+
"python_builder",
|
|
296
262
|
"pyproject-build-systems",
|
|
297
263
|
"nixpkgs"
|
|
298
264
|
],
|
|
299
265
|
"pyproject-nix": [
|
|
300
|
-
"
|
|
266
|
+
"python_builder",
|
|
301
267
|
"pyproject-build-systems",
|
|
302
268
|
"pyproject-nix"
|
|
303
269
|
]
|
|
@@ -318,7 +284,7 @@
|
|
|
318
284
|
},
|
|
319
285
|
"uv2nix_2": {
|
|
320
286
|
"inputs": {
|
|
321
|
-
"nixpkgs": "
|
|
287
|
+
"nixpkgs": "nixpkgs_4",
|
|
322
288
|
"pyproject-nix": "pyproject-nix_3"
|
|
323
289
|
},
|
|
324
290
|
"locked": {
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
description = "Timedoctor fluid SDK";
|
|
3
3
|
|
|
4
4
|
inputs = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
nixpkgs.url = "github:nixos/nixpkgs/2f5a153c270b70cb0f8c11f46d96d6d3bc39f4e3";
|
|
6
|
+
python_builder = {
|
|
7
|
+
url = "git+ssh://git@gitlab.com/fluidattacks/universe?shallow=1&rev=2490a24f91f075f7580cd0b9df5bc01dbc467a50&dir=common/utils/python-builder";
|
|
8
|
+
inputs.nixpkgs_flake.follows = "nixpkgs";
|
|
7
9
|
};
|
|
8
10
|
};
|
|
9
11
|
|
|
@@ -19,11 +21,10 @@
|
|
|
19
21
|
scripts,
|
|
20
22
|
}:
|
|
21
23
|
import ./build {
|
|
22
|
-
inherit nixpkgs builders scripts;
|
|
23
24
|
src = import ./build/filter.nix nixpkgs.nix-filter self;
|
|
24
25
|
};
|
|
25
26
|
in
|
|
26
27
|
{
|
|
27
|
-
packages = inputs.
|
|
28
|
+
packages = inputs.python_builder.outputs.build build_args;
|
|
28
29
|
};
|
|
29
30
|
}
|
|
@@ -65,8 +65,10 @@ def _decode_json_data(data: JsonObj) -> ResultE[AuthToken]:
|
|
|
65
65
|
def _decode_data(data: Coproduct[JsonObj, FrozenList[JsonObj]]) -> ResultE[AuthToken]:
|
|
66
66
|
return data.map(
|
|
67
67
|
_decode_json_data,
|
|
68
|
-
lambda _:
|
|
69
|
-
|
|
68
|
+
lambda _: (
|
|
69
|
+
Result[AuthToken, ValueError]
|
|
70
|
+
.failure(ValueError("Expected json but got a list"))
|
|
71
|
+
.alt(cast_exception)
|
|
70
72
|
),
|
|
71
73
|
)
|
|
72
74
|
|
|
@@ -83,7 +85,9 @@ def get_token(creds: Credentials) -> Cmd[ResultE[AuthToken]]:
|
|
|
83
85
|
Params(FrozenDict({})),
|
|
84
86
|
Data(_encode_creds(creds)),
|
|
85
87
|
).map(
|
|
86
|
-
lambda r:
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
lambda r: (
|
|
89
|
+
r.alt(cast_exception)
|
|
90
|
+
.bind(lambda s: handle_status(s).alt(cast_exception))
|
|
91
|
+
.bind(_decode_response)
|
|
92
|
+
),
|
|
89
93
|
)
|
|
@@ -29,7 +29,9 @@ def revoke(token: AuthToken) -> Cmd[ResultE[None]]:
|
|
|
29
29
|
relative_endpoint("api/1.0/logout"),
|
|
30
30
|
Params(FrozenDict({})),
|
|
31
31
|
).map(
|
|
32
|
-
lambda r:
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
lambda r: (
|
|
33
|
+
r.alt(cast_exception)
|
|
34
|
+
.bind(lambda s: handle_status(s).alt(cast_exception))
|
|
35
|
+
.map(lambda _: None)
|
|
36
|
+
),
|
|
35
37
|
)
|
|
@@ -25,6 +25,9 @@ def new_api_client(log: Logger, token: AuthToken) -> ApiClient:
|
|
|
25
25
|
get_projects_id=lambda c: _get_projects.get_projects(log, token, c),
|
|
26
26
|
get_worklogs=lambda c, u, d: _worklog.get_worklog(log, token, c, u, d),
|
|
27
27
|
get_activity_files=lambda c, u, d, e: _computer_activity.get_activity_files(
|
|
28
|
-
log,
|
|
28
|
+
log,
|
|
29
|
+
token,
|
|
30
|
+
_computer_activity.ActivityQuery(c, u, d),
|
|
31
|
+
e,
|
|
29
32
|
),
|
|
30
33
|
)
|
|
@@ -43,25 +43,25 @@ class DataPage(Generic[_T]):
|
|
|
43
43
|
|
|
44
44
|
def _one_or_none(items: FrozenList[_T]) -> ResultE[Maybe[_T]]:
|
|
45
45
|
if len(items) == 0:
|
|
46
|
-
return Result.success(Maybe.empty())
|
|
46
|
+
return Result[Maybe[_T], Exception].success(Maybe[_T].empty())
|
|
47
47
|
if len(items) == 1:
|
|
48
|
-
return Result.success(Maybe.some(items[0]))
|
|
49
|
-
return
|
|
50
|
-
ValueError
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
return Result[Maybe[_T], Exception].success(Maybe[_T].some(items[0]))
|
|
49
|
+
return (
|
|
50
|
+
Result[Maybe[_T], ValueError]
|
|
51
|
+
.failure(
|
|
52
|
+
ValueError(f"Expected only one element but got: {len(items)}"),
|
|
53
|
+
)
|
|
54
|
+
.alt(cast_exception)
|
|
53
55
|
)
|
|
54
56
|
|
|
55
57
|
|
|
56
|
-
def _decode_data_item(
|
|
57
|
-
raw: JsonObj, decode: Callable[[JsonValue], ResultE[_T]]
|
|
58
|
-
) -> ResultE[_T]:
|
|
58
|
+
def _decode_data_item(raw: JsonObj, decode: Callable[[JsonValue], ResultE[_T]]) -> ResultE[_T]:
|
|
59
59
|
return JsonUnfolder.require(
|
|
60
60
|
raw,
|
|
61
61
|
"data",
|
|
62
62
|
decode,
|
|
63
63
|
).alt(
|
|
64
|
-
lambda e: Bug.new(
|
|
64
|
+
lambda e: Bug[Exception].new(
|
|
65
65
|
"decode_json_data",
|
|
66
66
|
inspect.currentframe(),
|
|
67
67
|
e,
|
|
@@ -70,9 +70,7 @@ def _decode_data_item(
|
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
def decode_data(
|
|
74
|
-
raw: JsonObj, decode: Callable[[JsonObj], ResultE[_T]]
|
|
75
|
-
) -> ResultE[FrozenList[_T]]:
|
|
73
|
+
def decode_data(raw: JsonObj, decode: Callable[[JsonObj], ResultE[_T]]) -> ResultE[FrozenList[_T]]:
|
|
76
74
|
return _decode_data_item(
|
|
77
75
|
raw,
|
|
78
76
|
lambda v: Unfolder.to_list_of(v, lambda j: Unfolder.to_json(j).bind(decode)),
|
|
@@ -83,17 +81,17 @@ def decode_data_one_item(
|
|
|
83
81
|
raw: JsonObj,
|
|
84
82
|
decode: Callable[[JsonObj], ResultE[_T]],
|
|
85
83
|
) -> ResultE[FrozenList[_T]]:
|
|
86
|
-
empty: ResultE[FrozenList[_T]] = Result.success(()
|
|
84
|
+
empty: ResultE[FrozenList[_T]] = Result[FrozenList[_T], Exception].success(())
|
|
87
85
|
return _decode_data_item(
|
|
88
86
|
raw,
|
|
89
|
-
lambda v:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
lambda
|
|
94
|
-
v2, lambda j: Unfolder.to_json(j).bind(decode)
|
|
95
|
-
),
|
|
96
|
-
)
|
|
87
|
+
lambda v: (
|
|
88
|
+
Unfolder.to_list(v)
|
|
89
|
+
.bind(_one_or_none)
|
|
90
|
+
.bind(
|
|
91
|
+
lambda m: m.map(
|
|
92
|
+
lambda v2: Unfolder.to_list_of(v2, lambda j: Unfolder.to_json(j).bind(decode)),
|
|
93
|
+
).value_or(empty),
|
|
94
|
+
)
|
|
97
95
|
),
|
|
98
96
|
)
|
|
99
97
|
|
|
@@ -104,7 +102,7 @@ def _decode_next_page(data: JsonObj) -> ResultE[Maybe[str]]:
|
|
|
104
102
|
"next",
|
|
105
103
|
lambda v: Unfolder.to_primitive(v).bind(
|
|
106
104
|
lambda p: JsonPrimitiveUnfolder.to_str(p).lash(
|
|
107
|
-
lambda _: JsonPrimitiveUnfolder.to_int(p).map(str)
|
|
105
|
+
lambda _: JsonPrimitiveUnfolder.to_int(p).map(str),
|
|
108
106
|
),
|
|
109
107
|
),
|
|
110
108
|
)
|
|
@@ -128,7 +126,7 @@ def _decode_page_token_with_presence(
|
|
|
128
126
|
lambda v: Unfolder.to_json(v).bind(_decode_next_page),
|
|
129
127
|
).map(
|
|
130
128
|
lambda token: token.map(lambda next_token: (True, next_token)).value_or(
|
|
131
|
-
(False, Maybe.empty()),
|
|
129
|
+
(False, Maybe[str].empty()),
|
|
132
130
|
),
|
|
133
131
|
)
|
|
134
132
|
|
|
@@ -136,7 +134,9 @@ def _decode_page_token_with_presence(
|
|
|
136
134
|
def _decode_next_cursor(raw: JsonObj) -> ResultE[Maybe[str]]:
|
|
137
135
|
return _decode_page_token_with_presence(raw, "paging").bind(
|
|
138
136
|
lambda paging: (
|
|
139
|
-
Result.success(paging[1])
|
|
137
|
+
Result[Maybe[str], Exception].success(paging[1])
|
|
138
|
+
if paging[0]
|
|
139
|
+
else _decode_page_token(raw, "page")
|
|
140
140
|
),
|
|
141
141
|
)
|
|
142
142
|
|
|
@@ -148,7 +148,7 @@ def decode_page(
|
|
|
148
148
|
data = decode(raw)
|
|
149
149
|
next_page = _decode_next_cursor(raw)
|
|
150
150
|
return data.bind(lambda d: next_page.map(lambda p: DataPage(d, p))).alt(
|
|
151
|
-
lambda e: Bug.new(
|
|
151
|
+
lambda e: Bug[Exception].new(
|
|
152
152
|
"_decode_json_data",
|
|
153
153
|
inspect.currentframe(),
|
|
154
154
|
e,
|
|
@@ -163,14 +163,18 @@ def with_retry_handler(
|
|
|
163
163
|
) -> Cmd[ResultE[Response]]:
|
|
164
164
|
error_factory: HandledErrorFactory[HTTPError, Exception] = HandledErrorFactory()
|
|
165
165
|
handled_get_page = raw_page.map(
|
|
166
|
-
lambda r:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
lambda
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
lambda r: (
|
|
167
|
+
r.alt(cast_exception)
|
|
168
|
+
.alt(error_factory.unhandled)
|
|
169
|
+
.bind(
|
|
170
|
+
lambda r: handle_status(r).alt(
|
|
171
|
+
lambda e: (
|
|
172
|
+
error_factory.handled(e)
|
|
173
|
+
if e.errno and e.errno >= 500 and e.errno < 600 # noqa: PLR2004
|
|
174
|
+
else error_factory.unhandled(cast_exception(e))
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
)
|
|
174
178
|
),
|
|
175
179
|
)
|
|
176
180
|
return retry_cmd(
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
|
|
3
|
-
from fluidattacks_etl_utils import (
|
|
4
|
-
decode,
|
|
5
|
-
smash,
|
|
6
|
-
)
|
|
7
|
-
from fluidattacks_etl_utils.bug import (
|
|
8
|
-
Bug,
|
|
9
|
-
)
|
|
10
3
|
from fa_purity import (
|
|
11
4
|
FrozenList,
|
|
12
5
|
Result,
|
|
@@ -23,6 +16,13 @@ from fa_purity.json import (
|
|
|
23
16
|
JsonValue,
|
|
24
17
|
Unfolder,
|
|
25
18
|
)
|
|
19
|
+
from fluidattacks_etl_utils import (
|
|
20
|
+
decode,
|
|
21
|
+
smash,
|
|
22
|
+
)
|
|
23
|
+
from fluidattacks_etl_utils.bug import (
|
|
24
|
+
Bug,
|
|
25
|
+
)
|
|
26
26
|
|
|
27
27
|
from fluidattacks_timedoctor_sdk.core import (
|
|
28
28
|
ComputerActivity,
|
|
@@ -88,9 +88,9 @@ def decode_meta_obj(data: JsonObj) -> ResultE[MetaObj]:
|
|
|
88
88
|
|
|
89
89
|
def decode_file_entity(raw: str) -> ResultE[FileEntity]:
|
|
90
90
|
try:
|
|
91
|
-
return Result.success(FileEntity(raw.upper()))
|
|
91
|
+
return Result[FileEntity, Exception].success(FileEntity(raw.upper()))
|
|
92
92
|
except ValueError as err:
|
|
93
|
-
return Result.failure(err).alt(cast_exception)
|
|
93
|
+
return Result[FileEntity, ValueError].failure(err).alt(cast_exception)
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
def _decode_activity(
|
|
@@ -166,7 +166,7 @@ def decode_activities(data: JsonObj) -> ResultE[FrozenList[ComputerActivity]]:
|
|
|
166
166
|
),
|
|
167
167
|
),
|
|
168
168
|
).alt(
|
|
169
|
-
lambda e: Bug.new(
|
|
169
|
+
lambda e: Bug[Exception].new(
|
|
170
170
|
"decode_activities",
|
|
171
171
|
inspect.currentframe(),
|
|
172
172
|
e,
|