@seamapi/nextlove-sdk-generator 1.13.3 → 1.13.5
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/templates/abstract-routes.template.js +4 -1
- package/lib/generate-python-sdk/templates/abstract-routes.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/snippets/action-attempt-decide-and-wait-template.js +5 -0
- package/lib/generate-ruby-sdk/templates/snippets/action-attempt-decide-and-wait-template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js +4 -2
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/generate-python-sdk/templates/abstract-routes.template.ts +6 -1
- package/src/lib/generate-ruby-sdk/templates/snippets/action-attempt-decide-and-wait-template.ts +4 -0
- package/src/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.ts +4 -2
- package/lib/generate-ruby-sdk/templates/snippets/action-attempt-helpers-template.js +0 -40
- package/lib/generate-ruby-sdk/templates/snippets/action-attempt-helpers-template.js.map +0 -1
- package/src/lib/generate-ruby-sdk/templates/snippets/action-attempt-helpers-template.ts +0 -39
- /package/lib/generate-ruby-sdk/templates/snippets/{action-attempt-helpers-template.d.ts → action-attempt-decide-and-wait-template.d.ts} +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { pascalCase } from "change-case";
|
|
2
|
+
import { convertCustomResourceNamespace } from "../generate-python-sdk.js";
|
|
2
3
|
export default (namespaces) => `@dataclass
|
|
3
4
|
class AbstractRoutes(abc.ABC):
|
|
4
|
-
${namespaces
|
|
5
|
+
${namespaces
|
|
6
|
+
.map((ns) => ` ${ns}: Abstract${pascalCase(convertCustomResourceNamespace(ns))}`)
|
|
7
|
+
.join("\n")}
|
|
5
8
|
`;
|
|
6
9
|
//# sourceMappingURL=abstract-routes.template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-routes.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/abstract-routes.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"abstract-routes.template.js","sourceRoot":"","sources":["../../../src/lib/generate-python-sdk/templates/abstract-routes.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAA;AAE1E,eAAe,CAAC,UAAoB,EAAE,EAAE,CAAC;;EAEvC,UAAU;KACT,GAAG,CACF,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,aAAa,UAAU,CAAC,8BAA8B,CAAC,EAAE,CAAC,CAAC,EAAE,CAC7E;KACA,IAAI,CAAC,IAAI,CAAC;CACZ,CAAA"}
|
package/lib/generate-ruby-sdk/templates/snippets/action-attempt-decide-and-wait-template.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-attempt-decide-and-wait-template.js","sourceRoot":"","sources":["../../../../src/lib/generate-ruby-sdk/templates/snippets/action-attempt-decide-and-wait-template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;QAGb,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import actionAttemptDecideAndWaitTemplate from "./action-attempt-decide-and-wait-template.js";
|
|
2
2
|
export default ({ pascal_name, attrs, date_attrs, }) => {
|
|
3
3
|
const no_error_warning_attrs = attrs.filter((attr) => attr !== "errors" && attr !== "warnings");
|
|
4
4
|
const has_warnings_attr = attrs.includes("warnings");
|
|
@@ -18,6 +18,8 @@ export default ({ pascal_name, attrs, date_attrs, }) => {
|
|
|
18
18
|
const is_action_attempt_resource = pascal_name === "ActionAttempt";
|
|
19
19
|
return `# frozen_string_literal: true
|
|
20
20
|
|
|
21
|
+
${is_action_attempt_resource ? 'require "seam/utils/action_attempt_utils"' : ""}
|
|
22
|
+
|
|
21
23
|
module Seam
|
|
22
24
|
class ${pascal_name} < BaseResource
|
|
23
25
|
attr_accessor ${attr_accessors}
|
|
@@ -27,7 +29,7 @@ ${date_accessors}
|
|
|
27
29
|
${resource_errors_support}
|
|
28
30
|
${resource_warnings_support}
|
|
29
31
|
|
|
30
|
-
${is_action_attempt_resource ?
|
|
32
|
+
${is_action_attempt_resource ? actionAttemptDecideAndWaitTemplate() : ""}
|
|
31
33
|
end
|
|
32
34
|
end\n`;
|
|
33
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.rb.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"resource.rb.template.js","sourceRoot":"","sources":["../../../../src/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,MAAM,8CAA8C,CAAA;AAE7F,eAAe,CAAC,EACd,WAAW,EACX,KAAK,EACL,UAAU,GAKX,EAAE,EAAE;IACH,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CACnD,CAAA;IACD,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IACpD,MAAM,eAAe,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAEhD,MAAM,cAAc,GAAG,sBAAsB;SAC1C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,MAAM,cAAc,GAClB,UAAU,CAAC,MAAM,GAAG,CAAC;QACnB,CAAC,CAAC,qBAAqB,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACxE,CAAC,CAAC,EAAE,CAAA;IAER,MAAM,uBAAuB,GAAG,eAAe;QAC7C,CAAC,CAAC,yCAAyC;QAC3C,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,yBAAyB,GAAG,iBAAiB;QACjD,CAAC,CAAC,2CAA2C;QAC7C,CAAC,CAAC,EAAE,CAAA;IAEN,MAAM,0BAA0B,GAAG,WAAW,KAAK,eAAe,CAAA;IAElE,OAAO;;EAEP,0BAA0B,CAAC,CAAC,CAAC,2CAA2C,CAAC,CAAC,CAAC,EAAE;;;UAGrE,WAAW;oBACD,cAAc;;EAEhC,cAAc;;EAEd,uBAAuB;EACvB,yBAAyB;;EAEzB,0BAA0B,CAAC,CAAC,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC,EAAE;;MAElE,CAAA;AACN,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { pascalCase } from "change-case"
|
|
2
|
+
import { convertCustomResourceNamespace } from "../generate-python-sdk.js"
|
|
2
3
|
|
|
3
4
|
export default (namespaces: string[]) => `@dataclass
|
|
4
5
|
class AbstractRoutes(abc.ABC):
|
|
5
|
-
${namespaces
|
|
6
|
+
${namespaces
|
|
7
|
+
.map(
|
|
8
|
+
(ns) => ` ${ns}: Abstract${pascalCase(convertCustomResourceNamespace(ns))}`
|
|
9
|
+
)
|
|
10
|
+
.join("\n")}
|
|
6
11
|
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import actionAttemptDecideAndWaitTemplate from "./action-attempt-decide-and-wait-template.js"
|
|
2
2
|
|
|
3
3
|
export default ({
|
|
4
4
|
pascal_name,
|
|
@@ -34,6 +34,8 @@ export default ({
|
|
|
34
34
|
|
|
35
35
|
return `# frozen_string_literal: true
|
|
36
36
|
|
|
37
|
+
${is_action_attempt_resource ? 'require "seam/utils/action_attempt_utils"' : ""}
|
|
38
|
+
|
|
37
39
|
module Seam
|
|
38
40
|
class ${pascal_name} < BaseResource
|
|
39
41
|
attr_accessor ${attr_accessors}
|
|
@@ -43,7 +45,7 @@ ${date_accessors}
|
|
|
43
45
|
${resource_errors_support}
|
|
44
46
|
${resource_warnings_support}
|
|
45
47
|
|
|
46
|
-
${is_action_attempt_resource ?
|
|
48
|
+
${is_action_attempt_resource ? actionAttemptDecideAndWaitTemplate() : ""}
|
|
47
49
|
end
|
|
48
50
|
end\n`
|
|
49
51
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export default () => `
|
|
2
|
-
def decide_and_wait(wait_for_action_attempt)
|
|
3
|
-
wait_decision = wait_for_action_attempt.nil? ? @client.wait_for_action_attempt : wait_for_action_attempt
|
|
4
|
-
|
|
5
|
-
if wait_decision == true
|
|
6
|
-
wait_until_finished
|
|
7
|
-
elsif wait_decision.is_a?(Hash)
|
|
8
|
-
wait_until_finished(timeout: wait_decision[:timeout], polling_interval: wait_decision[:polling_interval])
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def wait_until_finished(timeout: 5.0, polling_interval: 0.5)
|
|
13
|
-
time_waiting = 0.0
|
|
14
|
-
|
|
15
|
-
while @status == "pending"
|
|
16
|
-
sleep(polling_interval)
|
|
17
|
-
time_waiting += polling_interval
|
|
18
|
-
|
|
19
|
-
raise "Timed out waiting for action attempt to be finished" if time_waiting > timeout
|
|
20
|
-
|
|
21
|
-
update!
|
|
22
|
-
|
|
23
|
-
raise "Action Attempt failed: #{error['message']}" if @status == "failed"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
self
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def update!
|
|
30
|
-
response = @client.request_seam(
|
|
31
|
-
:post,
|
|
32
|
-
"/action_attempts/get",
|
|
33
|
-
body: {
|
|
34
|
-
action_attempt_id: action_attempt_id
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
update_from_response(response["action_attempt"])
|
|
39
|
-
end`;
|
|
40
|
-
//# sourceMappingURL=action-attempt-helpers-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-attempt-helpers-template.js","sourceRoot":"","sources":["../../../../src/lib/generate-ruby-sdk/templates/snippets/action-attempt-helpers-template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsCb,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export default () => `
|
|
2
|
-
def decide_and_wait(wait_for_action_attempt)
|
|
3
|
-
wait_decision = wait_for_action_attempt.nil? ? @client.wait_for_action_attempt : wait_for_action_attempt
|
|
4
|
-
|
|
5
|
-
if wait_decision == true
|
|
6
|
-
wait_until_finished
|
|
7
|
-
elsif wait_decision.is_a?(Hash)
|
|
8
|
-
wait_until_finished(timeout: wait_decision[:timeout], polling_interval: wait_decision[:polling_interval])
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def wait_until_finished(timeout: 5.0, polling_interval: 0.5)
|
|
13
|
-
time_waiting = 0.0
|
|
14
|
-
|
|
15
|
-
while @status == "pending"
|
|
16
|
-
sleep(polling_interval)
|
|
17
|
-
time_waiting += polling_interval
|
|
18
|
-
|
|
19
|
-
raise "Timed out waiting for action attempt to be finished" if time_waiting > timeout
|
|
20
|
-
|
|
21
|
-
update!
|
|
22
|
-
|
|
23
|
-
raise "Action Attempt failed: #{error['message']}" if @status == "failed"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
self
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def update!
|
|
30
|
-
response = @client.request_seam(
|
|
31
|
-
:post,
|
|
32
|
-
"/action_attempts/get",
|
|
33
|
-
body: {
|
|
34
|
-
action_attempt_id: action_attempt_id
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
update_from_response(response["action_attempt"])
|
|
39
|
-
end`
|