@seamapi/nextlove-sdk-generator 1.7.7 → 1.7.8
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/lib/generate-python-sdk/class-file.js +36 -17
- package/lib/generate-python-sdk/class-file.js.map +1 -1
- package/lib/generate-python-sdk/templates/seam.py.template.js +2 -0
- package/lib/generate-python-sdk/templates/seam.py.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js +2 -0
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/generate-python-sdk/class-file.ts +36 -19
- package/src/lib/generate-python-sdk/templates/seam.py.template.ts +2 -0
- package/src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts +2 -0
|
@@ -41,11 +41,30 @@ export class ClassFile {
|
|
|
41
41
|
return_resource: "ActionAttempt",
|
|
42
42
|
path: "",
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
method_name: "decide_and_wait",
|
|
46
|
+
parameters: [
|
|
47
|
+
{
|
|
48
|
+
name: "action_attempt",
|
|
49
|
+
type: "ActionAttempt",
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "wait_for_action_attempt",
|
|
54
|
+
type: "Union[bool, Dict[str, float]]",
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
return_path: [],
|
|
59
|
+
return_resource: "ActionAttempt",
|
|
60
|
+
path: "",
|
|
61
|
+
},
|
|
44
62
|
]
|
|
45
63
|
: [])
|
|
46
64
|
.map(({ method_name, parameters, return_resource }) => {
|
|
47
65
|
const has_params = parameters.length > 0;
|
|
48
|
-
const can_method_poll_action_attempt = return_resource === "ActionAttempt"
|
|
66
|
+
const can_method_poll_action_attempt = return_resource === "ActionAttempt" &&
|
|
67
|
+
method_name !== "poll_until_ready";
|
|
49
68
|
return [
|
|
50
69
|
"",
|
|
51
70
|
"",
|
|
@@ -58,7 +77,7 @@ export class ClassFile {
|
|
|
58
77
|
: `${name}: Optional[${type}] = ${default_value ?? "None"}`)
|
|
59
78
|
.concat(can_method_poll_action_attempt
|
|
60
79
|
? [
|
|
61
|
-
"wait_for_action_attempt: Union[bool, Dict[str, float]] =
|
|
80
|
+
"wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None",
|
|
62
81
|
]
|
|
63
82
|
: [])
|
|
64
83
|
.join(", ")}) -> ${return_resource}:`,
|
|
@@ -128,7 +147,7 @@ export class ClassFile {
|
|
|
128
147
|
: `${name}: Optional[${type}] = None`)
|
|
129
148
|
.concat(can_method_poll_action_attempt
|
|
130
149
|
? [
|
|
131
|
-
"wait_for_action_attempt: Union[bool, Dict[str, float]] =
|
|
150
|
+
"wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None",
|
|
132
151
|
]
|
|
133
152
|
: [])
|
|
134
153
|
.join(", ")}) -> ${return_resource}:`,
|
|
@@ -144,20 +163,10 @@ export class ClassFile {
|
|
|
144
163
|
"",
|
|
145
164
|
can_method_poll_action_attempt
|
|
146
165
|
? [
|
|
147
|
-
"
|
|
148
|
-
`
|
|
149
|
-
|
|
150
|
-
"
|
|
151
|
-
" polling_interval=wait_for_action_attempt.get('polling_interval', None),",
|
|
152
|
-
" )",
|
|
153
|
-
" elif wait_for_action_attempt is True:",
|
|
154
|
-
` updated_action_attempt = self.seam.action_attempts.poll_until_ready(`,
|
|
155
|
-
" action_attempt_id=res['action_attempt']['action_attempt_id']",
|
|
156
|
-
" )",
|
|
157
|
-
" else:",
|
|
158
|
-
` return ${return_resource}.from_dict(res["${return_path.join('"]["')}"])`,
|
|
159
|
-
"",
|
|
160
|
-
" return updated_action_attempt",
|
|
166
|
+
" return self.seam.action_attempts.decide_and_wait(",
|
|
167
|
+
` action_attempt=ActionAttempt.from_dict(res["action_attempt"]),`,
|
|
168
|
+
` wait_for_action_attempt=wait_for_action_attempt`,
|
|
169
|
+
" )",
|
|
161
170
|
].join("\n")
|
|
162
171
|
: "",
|
|
163
172
|
"",
|
|
@@ -196,6 +205,16 @@ export class ClassFile {
|
|
|
196
205
|
" raise Exception(f'Action Attempt failed: {action_attempt.error.message}')",
|
|
197
206
|
"",
|
|
198
207
|
" return action_attempt",
|
|
208
|
+
"",
|
|
209
|
+
" def decide_and_wait(self, *, action_attempt: ActionAttempt, wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None) -> ActionAttempt:",
|
|
210
|
+
" wait_decision = self.seam.wait_for_action_attempt if wait_for_action_attempt is None else wait_for_action_attempt",
|
|
211
|
+
"",
|
|
212
|
+
" if wait_decision is True:",
|
|
213
|
+
" return self.seam.action_attempts.poll_until_ready(action_attempt_id=action_attempt.action_attempt_id)",
|
|
214
|
+
" elif isinstance(wait_decision, dict):",
|
|
215
|
+
" return self.seam.action_attempts.poll_until_ready(action_attempt_id=action_attempt.action_attempt_id, timeout=wait_decision.get('timeout', None), polling_interval=wait_decision.get('polling_interval', None))",
|
|
216
|
+
"",
|
|
217
|
+
" return action_attempt",
|
|
199
218
|
].join("\n")
|
|
200
219
|
: "",
|
|
201
220
|
].join("\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-file.js","sourceRoot":"","sources":["../../src/lib/generate-python-sdk/class-file.ts"],"names":[],"mappings":"AA6BA,MAAM,OAAO,SAAS;IAMpB,YACE,IAAY,EACZ,SAA6B,EAC7B,uBAA+C;QAE/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAA;IACxD,CAAC;IAED,SAAS,CAAC,MAAuB;QAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,CAAC;IAED,sCAAsC;QACpC,MAAM,iBAAiB,GAAG,IAA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HAAuH;oBACvH,EAAE;oBACF,+BAA+B;oBAC/B,6GAA6G;oBAC7G,2CAA2C;oBAC3C,uNAAuN;oBACvN,EAAE;oBACF,2BAA2B;iBAC5B,CAAC,IAAI,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,EAAE;SACP,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACd,CAAC;CACF"}
|
|
@@ -22,6 +22,7 @@ class Seam(AbstractSeam):
|
|
|
22
22
|
*,
|
|
23
23
|
workspace_id: Optional[str] = None,
|
|
24
24
|
api_url: Optional[str] = None,
|
|
25
|
+
wait_for_action_attempt: Optional[bool] = False,
|
|
25
26
|
):
|
|
26
27
|
"""
|
|
27
28
|
Parameters
|
|
@@ -46,6 +47,7 @@ class Seam(AbstractSeam):
|
|
|
46
47
|
self.api_key = api_key
|
|
47
48
|
self.workspace_id = workspace_id
|
|
48
49
|
self.lts_version = Seam.lts_version
|
|
50
|
+
self.wait_for_action_attempt = wait_for_action_attempt
|
|
49
51
|
|
|
50
52
|
if os.environ.get("SEAM_API_URL", None) is not None:
|
|
51
53
|
print(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seam.py.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/seam.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"seam.py.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/seam.py.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGpB,CAAA"}
|
|
@@ -4,6 +4,7 @@ class AbstractSeam(AbstractRoutes):
|
|
|
4
4
|
workspace_id: str
|
|
5
5
|
api_url: str
|
|
6
6
|
lts_version: str
|
|
7
|
+
wait_for_action_attempt: bool
|
|
7
8
|
|
|
8
9
|
@abc.abstractmethod
|
|
9
10
|
def __init__(
|
|
@@ -12,6 +13,7 @@ class AbstractSeam(AbstractRoutes):
|
|
|
12
13
|
*,
|
|
13
14
|
workspace_id: Optional[str] = None,
|
|
14
15
|
api_url: Optional[str] = None,
|
|
16
|
+
wait_for_action_attempt: Optional[bool] = False,
|
|
15
17
|
):
|
|
16
18
|
raise NotImplementedError`;
|
|
17
19
|
//# sourceMappingURL=abstract-seam.template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-seam.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"abstract-seam.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;kCAiBa,CAAA"}
|
package/package.json
CHANGED
|
@@ -87,13 +87,32 @@ export class ClassFile {
|
|
|
87
87
|
return_resource: "ActionAttempt",
|
|
88
88
|
path: "",
|
|
89
89
|
},
|
|
90
|
+
{
|
|
91
|
+
method_name: "decide_and_wait",
|
|
92
|
+
parameters: [
|
|
93
|
+
{
|
|
94
|
+
name: "action_attempt",
|
|
95
|
+
type: "ActionAttempt",
|
|
96
|
+
required: true,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "wait_for_action_attempt",
|
|
100
|
+
type: "Union[bool, Dict[str, float]]",
|
|
101
|
+
required: true,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
return_path: [],
|
|
105
|
+
return_resource: "ActionAttempt",
|
|
106
|
+
path: "",
|
|
107
|
+
},
|
|
90
108
|
]
|
|
91
109
|
: []
|
|
92
110
|
)
|
|
93
111
|
.map(({ method_name, parameters, return_resource }) => {
|
|
94
112
|
const has_params = parameters.length > 0
|
|
95
113
|
const can_method_poll_action_attempt =
|
|
96
|
-
return_resource === "ActionAttempt"
|
|
114
|
+
return_resource === "ActionAttempt" &&
|
|
115
|
+
method_name !== "poll_until_ready"
|
|
97
116
|
|
|
98
117
|
return [
|
|
99
118
|
"",
|
|
@@ -113,7 +132,7 @@ export class ClassFile {
|
|
|
113
132
|
.concat(
|
|
114
133
|
can_method_poll_action_attempt
|
|
115
134
|
? [
|
|
116
|
-
"wait_for_action_attempt: Union[bool, Dict[str, float]] =
|
|
135
|
+
"wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None",
|
|
117
136
|
]
|
|
118
137
|
: []
|
|
119
138
|
)
|
|
@@ -218,7 +237,7 @@ export class ClassFile {
|
|
|
218
237
|
.concat(
|
|
219
238
|
can_method_poll_action_attempt
|
|
220
239
|
? [
|
|
221
|
-
"wait_for_action_attempt: Union[bool, Dict[str, float]] =
|
|
240
|
+
"wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None",
|
|
222
241
|
]
|
|
223
242
|
: []
|
|
224
243
|
)
|
|
@@ -242,22 +261,10 @@ export class ClassFile {
|
|
|
242
261
|
|
|
243
262
|
can_method_poll_action_attempt
|
|
244
263
|
? [
|
|
245
|
-
"
|
|
246
|
-
`
|
|
247
|
-
|
|
248
|
-
"
|
|
249
|
-
" polling_interval=wait_for_action_attempt.get('polling_interval', None),",
|
|
250
|
-
" )",
|
|
251
|
-
" elif wait_for_action_attempt is True:",
|
|
252
|
-
` updated_action_attempt = self.seam.action_attempts.poll_until_ready(`,
|
|
253
|
-
" action_attempt_id=res['action_attempt']['action_attempt_id']",
|
|
254
|
-
" )",
|
|
255
|
-
" else:",
|
|
256
|
-
` return ${return_resource}.from_dict(res["${return_path.join(
|
|
257
|
-
'"]["'
|
|
258
|
-
)}"])`,
|
|
259
|
-
"",
|
|
260
|
-
" return updated_action_attempt",
|
|
264
|
+
" return self.seam.action_attempts.decide_and_wait(",
|
|
265
|
+
` action_attempt=ActionAttempt.from_dict(res["action_attempt"]),`,
|
|
266
|
+
` wait_for_action_attempt=wait_for_action_attempt`,
|
|
267
|
+
" )",
|
|
261
268
|
].join("\n")
|
|
262
269
|
: "",
|
|
263
270
|
"",
|
|
@@ -302,6 +309,16 @@ export class ClassFile {
|
|
|
302
309
|
" raise Exception(f'Action Attempt failed: {action_attempt.error.message}')",
|
|
303
310
|
"",
|
|
304
311
|
" return action_attempt",
|
|
312
|
+
"",
|
|
313
|
+
" def decide_and_wait(self, *, action_attempt: ActionAttempt, wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None) -> ActionAttempt:",
|
|
314
|
+
" wait_decision = self.seam.wait_for_action_attempt if wait_for_action_attempt is None else wait_for_action_attempt",
|
|
315
|
+
"",
|
|
316
|
+
" if wait_decision is True:",
|
|
317
|
+
" return self.seam.action_attempts.poll_until_ready(action_attempt_id=action_attempt.action_attempt_id)",
|
|
318
|
+
" elif isinstance(wait_decision, dict):",
|
|
319
|
+
" return self.seam.action_attempts.poll_until_ready(action_attempt_id=action_attempt.action_attempt_id, timeout=wait_decision.get('timeout', None), polling_interval=wait_decision.get('polling_interval', None))",
|
|
320
|
+
"",
|
|
321
|
+
" return action_attempt",
|
|
305
322
|
].join("\n")
|
|
306
323
|
: "",
|
|
307
324
|
].join("\n")
|
|
@@ -22,6 +22,7 @@ class Seam(AbstractSeam):
|
|
|
22
22
|
*,
|
|
23
23
|
workspace_id: Optional[str] = None,
|
|
24
24
|
api_url: Optional[str] = None,
|
|
25
|
+
wait_for_action_attempt: Optional[bool] = False,
|
|
25
26
|
):
|
|
26
27
|
"""
|
|
27
28
|
Parameters
|
|
@@ -46,6 +47,7 @@ class Seam(AbstractSeam):
|
|
|
46
47
|
self.api_key = api_key
|
|
47
48
|
self.workspace_id = workspace_id
|
|
48
49
|
self.lts_version = Seam.lts_version
|
|
50
|
+
self.wait_for_action_attempt = wait_for_action_attempt
|
|
49
51
|
|
|
50
52
|
if os.environ.get("SEAM_API_URL", None) is not None:
|
|
51
53
|
print(
|
|
@@ -4,6 +4,7 @@ class AbstractSeam(AbstractRoutes):
|
|
|
4
4
|
workspace_id: str
|
|
5
5
|
api_url: str
|
|
6
6
|
lts_version: str
|
|
7
|
+
wait_for_action_attempt: bool
|
|
7
8
|
|
|
8
9
|
@abc.abstractmethod
|
|
9
10
|
def __init__(
|
|
@@ -12,5 +13,6 @@ class AbstractSeam(AbstractRoutes):
|
|
|
12
13
|
*,
|
|
13
14
|
workspace_id: Optional[str] = None,
|
|
14
15
|
api_url: Optional[str] = None,
|
|
16
|
+
wait_for_action_attempt: Optional[bool] = False,
|
|
15
17
|
):
|
|
16
18
|
raise NotImplementedError`
|