@seamapi/nextlove-sdk-generator 1.6.2 → 1.7.1
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/generate-python-sdk.js +0 -6
- package/lib/generate-python-sdk/generate-python-sdk.js.map +1 -1
- package/lib/generate-python-sdk/templates/.gitignore.template.js +0 -1
- package/lib/generate-python-sdk/templates/.gitignore.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/conftest.py.template.js +0 -57
- package/lib/generate-python-sdk/templates/conftest.py.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js +0 -1
- package/lib/generate-python-sdk/templates/pyproject.toml.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/seam.py.template.js +0 -58
- package/lib/generate-python-sdk/templates/seam.py.template.js.map +1 -1
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js +0 -1
- package/lib/generate-python-sdk/templates/snippets/abstract-seam.template.js.map +1 -1
- package/lib/generate-ruby-sdk/generate-ruby-sdk.js +4 -1
- package/lib/generate-ruby-sdk/generate-ruby-sdk.js.map +1 -1
- package/lib/generate-ruby-sdk/ruby-client.js +19 -12
- package/lib/generate-ruby-sdk/ruby-client.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/.rspec.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/.rspec.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/.ruby-version.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/.ruby-version.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/base_client.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/base_resource.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/client.rb.template.js +62 -48
- package/lib/generate-ruby-sdk/templates/client.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/gemfile.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/gemfile.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/logger.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/logger.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/lts_version.rb.template.js +6 -0
- package/lib/generate-ruby-sdk/templates/lts_version.rb.template.js.map +1 -0
- package/lib/generate-ruby-sdk/templates/rakefile.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/rakefile.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/request.rb.template.js +5 -2
- package/lib/generate-ruby-sdk/templates/request.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/resource_error.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/resource_warning.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/snippets/action-attempt-helpers-template.js +20 -8
- package/lib/generate-ruby-sdk/templates/snippets/action-attempt-helpers-template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js +8 -8
- package/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/spec_helper.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/spec_helper.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/support-helpers.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/support-helpers.rb.template.js.map +1 -1
- package/lib/generate-ruby-sdk/templates/version.rb.template.js +1 -1
- package/lib/generate-ruby-sdk/templates/version.rb.template.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/generate-python-sdk/generate-python-sdk.ts +0 -7
- package/src/lib/generate-python-sdk/templates/.gitignore.template.ts +0 -1
- package/src/lib/generate-python-sdk/templates/conftest.py.template.ts +0 -57
- package/src/lib/generate-python-sdk/templates/pyproject.toml.template.ts +0 -1
- package/src/lib/generate-python-sdk/templates/seam.py.template.ts +0 -58
- package/src/lib/generate-python-sdk/templates/snippets/abstract-seam.template.ts +0 -1
- package/src/lib/generate-ruby-sdk/generate-ruby-sdk.ts +4 -1
- package/src/lib/generate-ruby-sdk/ruby-client.ts +22 -14
- package/src/lib/generate-ruby-sdk/templates/.rspec.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/.ruby-version.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/base_client.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/base_resource.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/client.rb.template.ts +62 -48
- package/src/lib/generate-ruby-sdk/templates/gemfile.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/logger.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/lts_version.rb.template.ts +5 -0
- package/src/lib/generate-ruby-sdk/templates/rakefile.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/request.rb.template.ts +5 -2
- package/src/lib/generate-ruby-sdk/templates/resource_error.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/resource_warning.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/snippets/action-attempt-helpers-template.ts +20 -8
- package/src/lib/generate-ruby-sdk/templates/snippets/resource.rb.template.ts +8 -8
- package/src/lib/generate-ruby-sdk/templates/spec_helper.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/support-helpers.rb.template.ts +1 -1
- package/src/lib/generate-ruby-sdk/templates/version.rb.template.ts +1 -1
- package/lib/generate-python-sdk/templates/prebuild.py.template.js +0 -13
- package/lib/generate-python-sdk/templates/prebuild.py.template.js.map +0 -1
- package/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.d.ts +0 -2
- package/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.js +0 -6
- package/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.js.map +0 -1
- package/lib/generate-python-sdk/templates/utils/report_error.py.template.d.ts +0 -2
- package/lib/generate-python-sdk/templates/utils/report_error.py.template.js +0 -17
- package/lib/generate-python-sdk/templates/utils/report_error.py.template.js.map +0 -1
- package/lib/generate-ruby-sdk/request.rb.template.d.ts +0 -1
- package/lib/generate-ruby-sdk/request.rb.template.js +0 -2
- package/lib/generate-ruby-sdk/request.rb.template.js.map +0 -1
- package/src/lib/generate-python-sdk/templates/prebuild.py.template.ts +0 -12
- package/src/lib/generate-python-sdk/templates/utils/get_sentry_dsn.py.template.ts +0 -5
- package/src/lib/generate-python-sdk/templates/utils/report_error.py.template.ts +0 -16
- package/src/lib/generate-ruby-sdk/request.rb.template.ts +0 -0
- /package/lib/{generate-python-sdk/templates/prebuild.py.template.d.ts → generate-ruby-sdk/templates/lts_version.rb.template.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rakefile.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/rakefile.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"rakefile.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/rakefile.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;MAqBf,CAAA"}
|
|
@@ -59,7 +59,10 @@ module Seam
|
|
|
59
59
|
{
|
|
60
60
|
"User-Agent" => user_agent,
|
|
61
61
|
"Content-Type" => "application/json",
|
|
62
|
-
"Authorization" => "Bearer #{api_key}"
|
|
62
|
+
"Authorization" => "Bearer #{api_key}",
|
|
63
|
+
"seam-sdk-name": "seamapi/ruby",
|
|
64
|
+
"seam-sdk-version": Seam::VERSION,
|
|
65
|
+
"seam-lts-version": Seam::LTS_VERSION
|
|
63
66
|
}
|
|
64
67
|
end
|
|
65
68
|
|
|
@@ -67,5 +70,5 @@ module Seam
|
|
|
67
70
|
"seam-ruby/#{Seam::VERSION}"
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
|
-
end`;
|
|
73
|
+
end\n`;
|
|
71
74
|
//# sourceMappingURL=request.rb.template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/request.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"request.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/request.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAwEf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource_error.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_error.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resource_error.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_error.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;MAQf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource_errors_support.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resource_errors_support.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_errors_support.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;MAQf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource_warning.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_warning.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resource_warning.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_warning.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;MAQf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource_warnings_support.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resource_warnings_support.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/resource_warnings_support.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;MAQf,CAAA"}
|
|
@@ -37,5 +37,5 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_development_dependency "simplecov-console", "~> 0.9"
|
|
38
38
|
spec.add_development_dependency "standard", "~> 1.3"
|
|
39
39
|
spec.add_development_dependency "webmock", "~> 3.0.0"
|
|
40
|
-
end`;
|
|
40
|
+
end\n`;
|
|
41
41
|
//# sourceMappingURL=seamapi.gemspec.template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seamapi.gemspec.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"seamapi.gemspec.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/seamapi.gemspec.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuCf,CAAA"}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
export default () => `
|
|
2
|
-
|
|
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
|
|
3
14
|
|
|
4
|
-
def wait_until_finished
|
|
5
|
-
attempts = 0
|
|
6
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
|
+
|
|
7
21
|
update!
|
|
8
|
-
sleep(SLEEP_TIME)
|
|
9
|
-
attempts += 1
|
|
10
|
-
end
|
|
11
22
|
|
|
12
|
-
|
|
23
|
+
raise "Action Attempt failed: #{error['message']}" if @status == "failed"
|
|
24
|
+
end
|
|
13
25
|
|
|
14
26
|
self
|
|
15
27
|
end
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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"}
|
|
@@ -7,13 +7,13 @@ export default ({ pascal_name, attrs, date_attrs, }) => {
|
|
|
7
7
|
.map((attr) => `:${attr}`)
|
|
8
8
|
.join(", ");
|
|
9
9
|
const date_accessors = date_attrs.length > 0
|
|
10
|
-
? `date_accessor ${date_attrs.map((attr) => `:${attr}`).join(", ")}`
|
|
10
|
+
? ` date_accessor ${date_attrs.map((attr) => `:${attr}`).join(", ")}`
|
|
11
11
|
: "";
|
|
12
12
|
const resource_errors_support = has_errors_attr
|
|
13
|
-
? "include Seam::ResourceErrorsSupport"
|
|
13
|
+
? " include Seam::ResourceErrorsSupport"
|
|
14
14
|
: "";
|
|
15
15
|
const resource_warnings_support = has_warnings_attr
|
|
16
|
-
? "include Seam::ResourceWarningsSupport"
|
|
16
|
+
? " include Seam::ResourceWarningsSupport"
|
|
17
17
|
: "";
|
|
18
18
|
const is_action_attempt_resource = pascal_name === "ActionAttempt";
|
|
19
19
|
return `# frozen_string_literal: true
|
|
@@ -22,13 +22,13 @@ module Seam
|
|
|
22
22
|
class ${pascal_name} < BaseResource
|
|
23
23
|
attr_accessor ${attr_accessors}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
${date_accessors}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
${resource_errors_support}
|
|
28
|
+
${resource_warnings_support}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
${is_action_attempt_resource ? actionAttemptHelpersTemplate() : ""}
|
|
31
31
|
end
|
|
32
|
-
end`;
|
|
32
|
+
end\n`;
|
|
33
33
|
};
|
|
34
34
|
//# sourceMappingURL=resource.rb.template.js.map
|
|
@@ -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,4BAA4B,MAAM,sCAAsC,CAAA;AAE/E,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,
|
|
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,4BAA4B,MAAM,sCAAsC,CAAA;AAE/E,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;;;UAGC,WAAW;oBACD,cAAc;;EAEhC,cAAc;;EAEd,uBAAuB;EACvB,yBAAyB;;EAEzB,0BAA0B,CAAC,CAAC,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC,EAAE;;MAE5D,CAAA;AACN,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec_helper.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/spec_helper.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"spec_helper.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/spec_helper.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2Bf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support-helpers.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/support-helpers.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"support-helpers.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/support-helpers.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;;;;;;;MAUf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/version.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"version.rb.template.js","sourceRoot":"","sources":["../../../src/lib/generate-ruby-sdk/templates/version.rb.template.ts"],"names":[],"mappings":"AAAA,eAAe,GAAG,EAAE,CAAC;;;;MAIf,CAAA"}
|
package/package.json
CHANGED
|
@@ -16,9 +16,6 @@ import resourceDataclassTemplate from "./templates/snippets/resource-dataclass.t
|
|
|
16
16
|
import readmeMdTemplate from "./templates/readme.md.template.js"
|
|
17
17
|
import initTemplate from "./templates/__init__.py.template.js"
|
|
18
18
|
import gitignoreTemplate from "./templates/.gitignore.template.js"
|
|
19
|
-
import prebuildTemplate from "./templates/prebuild.py.template.js"
|
|
20
|
-
import reportErrorTemplate from "./templates/utils/report_error.py.template.js"
|
|
21
|
-
import getSentryDsnTemplate from "./templates/utils/get_sentry_dsn.py.template.js"
|
|
22
19
|
import SeamApiExceptionClassTemplate from "./templates/snippets/seam-api-exception-class.template.js"
|
|
23
20
|
import { getParameterAndResponseSchema } from "lib/openapi/get-parameter-and-response-schema.js"
|
|
24
21
|
import mapParentToChildResources from "lib/openapi/map-parent-to-children-resource.js"
|
|
@@ -177,16 +174,12 @@ export const generatePythonSDK = async () => {
|
|
|
177
174
|
fs["README.md"] = readmeMdTemplate()
|
|
178
175
|
fs["pyproject.toml"] = pyprojectTomlTemplate()
|
|
179
176
|
fs[".gitignore"] = gitignoreTemplate()
|
|
180
|
-
fs["scripts/prebuild.py"] = prebuildTemplate()
|
|
181
177
|
|
|
182
178
|
fs["seamapi/__init__.py"] = initTemplate()
|
|
183
179
|
fs["seamapi/routes.py"] = routesPyTemplate(top_level_namespaces)
|
|
184
180
|
fs["seamapi/seam.py"] = seamPyTemplate()
|
|
185
181
|
fs["seamapi/utils/deep_attr_dict.py"] = deep_attr_dictPyTemplate()
|
|
186
182
|
|
|
187
|
-
fs["seamapi/utils/report_error.py"] = reportErrorTemplate()
|
|
188
|
-
fs["seamapi/utils/get_sentry_dsn.py"] = getSentryDsnTemplate()
|
|
189
|
-
|
|
190
183
|
fs["tests/conftest.py"] = conftestPyTemplate()
|
|
191
184
|
fs["tests/test_smoke.py"] = test_smokePyTemplate()
|
|
192
185
|
fs["tests/__init__.py"] = ""
|
|
@@ -11,13 +11,6 @@ from dataclasses import dataclass
|
|
|
11
11
|
def dotenv_fixture():
|
|
12
12
|
load_dotenv()
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
@dataclass
|
|
16
|
-
class SeamBackend:
|
|
17
|
-
url: str
|
|
18
|
-
sandbox_api_key: str
|
|
19
|
-
|
|
20
|
-
|
|
21
14
|
# TODO this should use scope="session", but there's some issue, this would
|
|
22
15
|
# dramatically reduce test time to switch
|
|
23
16
|
@pytest.fixture(scope="function")
|
|
@@ -27,54 +20,4 @@ def seam_backend():
|
|
|
27
20
|
url=f"https://{random_string}.fakeseamconnect.seam.vc",
|
|
28
21
|
sandbox_api_key="seam_apikey1_token",
|
|
29
22
|
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.fixture
|
|
33
|
-
def seam(seam_backend: Any):
|
|
34
|
-
seam = Seam(api_url=seam_backend.url, api_key=seam_backend.sandbox_api_key)
|
|
35
|
-
# seam.make_request("POST", "/workspaces/reset_sandbox")
|
|
36
|
-
yield seam
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
@pytest.fixture
|
|
40
|
-
def fake_sentry(monkeypatch):
|
|
41
|
-
sentry_dsn = "https://key@sentry.io/123"
|
|
42
|
-
|
|
43
|
-
monkeypatch.setenv("SENTRY_DSN", sentry_dsn)
|
|
44
|
-
|
|
45
|
-
sentry_init_args = {}
|
|
46
|
-
sentry_capture_exception_calls = []
|
|
47
|
-
sentry_add_breadcrumb_calls = []
|
|
48
|
-
|
|
49
|
-
class TestSentryClient(object):
|
|
50
|
-
def __init__(self, *args, **kwargs):
|
|
51
|
-
sentry_init_args.update(kwargs)
|
|
52
|
-
|
|
53
|
-
def set_context(self, *args, **kwargs):
|
|
54
|
-
pass
|
|
55
|
-
|
|
56
|
-
monkeypatch.setattr("sentry_sdk.Client", TestSentryClient)
|
|
57
|
-
|
|
58
|
-
class TestSentryScope(object):
|
|
59
|
-
def set_context(self, *args, **kwargs):
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
class TestSentryHub(object):
|
|
63
|
-
def __init__(self, *args, **kwargs):
|
|
64
|
-
self.scope = TestSentryScope()
|
|
65
|
-
|
|
66
|
-
def capture_exception(self, *args, **kwargs):
|
|
67
|
-
sentry_capture_exception_calls.append((args, kwargs))
|
|
68
|
-
|
|
69
|
-
def add_breadcrumb(self, *args, **kwargs):
|
|
70
|
-
sentry_add_breadcrumb_calls.append((args, kwargs))
|
|
71
|
-
|
|
72
|
-
monkeypatch.setattr("sentry_sdk.Hub", TestSentryHub)
|
|
73
|
-
|
|
74
|
-
yield {
|
|
75
|
-
"sentry_init_args": sentry_init_args,
|
|
76
|
-
"sentry_capture_exception_calls": sentry_capture_exception_calls,
|
|
77
|
-
"sentry_add_breadcrumb_calls": sentry_add_breadcrumb_calls,
|
|
78
|
-
"sentry_dsn": sentry_dsn,
|
|
79
|
-
}
|
|
80
23
|
`
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export default () => `import os
|
|
2
2
|
|
|
3
|
-
from seamapi.utils.get_sentry_dsn import get_sentry_dsn
|
|
4
3
|
from .routes import Routes
|
|
5
4
|
import requests
|
|
6
|
-
import sentry_sdk
|
|
7
5
|
import pkg_resources
|
|
8
6
|
from typing import Optional, cast
|
|
9
7
|
from .types import AbstractSeam, SeamApiException
|
|
@@ -12,33 +10,6 @@ from .types import AbstractSeam, SeamApiException
|
|
|
12
10
|
class Seam(AbstractSeam):
|
|
13
11
|
"""
|
|
14
12
|
Initial Seam class used to interact with Seam API
|
|
15
|
-
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
Attributes
|
|
19
|
-
----------
|
|
20
|
-
api_key : str
|
|
21
|
-
API key (default None)
|
|
22
|
-
api_url : str
|
|
23
|
-
API url (default "https://connect.getseam.com")
|
|
24
|
-
lts_version : str
|
|
25
|
-
LTS version
|
|
26
|
-
workspaces : Workspaces
|
|
27
|
-
Workspaces class
|
|
28
|
-
connected_accounts : ConnectedAccounts
|
|
29
|
-
Connected accounts class
|
|
30
|
-
connect_webviews : ConnectWebviews
|
|
31
|
-
Connect webviews class
|
|
32
|
-
devices : Devices
|
|
33
|
-
Devices class
|
|
34
|
-
events : Events
|
|
35
|
-
Events class
|
|
36
|
-
locks : Locks
|
|
37
|
-
Locks class
|
|
38
|
-
access_codes : AccessCodes
|
|
39
|
-
Access codes class
|
|
40
|
-
action_attempts : ActionAttempts
|
|
41
|
-
Action attempts class
|
|
42
13
|
"""
|
|
43
14
|
|
|
44
15
|
api_key: str
|
|
@@ -51,7 +22,6 @@ class Seam(AbstractSeam):
|
|
|
51
22
|
*,
|
|
52
23
|
workspace_id: Optional[str] = None,
|
|
53
24
|
api_url: Optional[str] = None,
|
|
54
|
-
should_report_exceptions: Optional[bool] = False,
|
|
55
25
|
):
|
|
56
26
|
"""
|
|
57
27
|
Parameters
|
|
@@ -62,8 +32,6 @@ class Seam(AbstractSeam):
|
|
|
62
32
|
Workspace id
|
|
63
33
|
api_url : str, optional
|
|
64
34
|
API url
|
|
65
|
-
should_report_exceptions : bool, optional
|
|
66
|
-
Defaults to False. If true, thrown exceptions will be reported to Seam.
|
|
67
35
|
"""
|
|
68
36
|
Routes.__init__(self)
|
|
69
37
|
|
|
@@ -91,18 +59,6 @@ class Seam(AbstractSeam):
|
|
|
91
59
|
if api_url is not None:
|
|
92
60
|
self.api_url = cast(str, api_url)
|
|
93
61
|
|
|
94
|
-
self.should_report_exceptions = should_report_exceptions
|
|
95
|
-
|
|
96
|
-
if self.should_report_exceptions:
|
|
97
|
-
self.sentry_client = sentry_sdk.Hub(sentry_sdk.Client(
|
|
98
|
-
dsn=get_sentry_dsn(),
|
|
99
|
-
))
|
|
100
|
-
self.sentry_client.scope.set_context("sdk_info", {
|
|
101
|
-
"repository": "https://github.com/seamapi/python",
|
|
102
|
-
"version": pkg_resources.get_distribution("seamapi").version,
|
|
103
|
-
"endpoint": self.api_url,
|
|
104
|
-
})
|
|
105
|
-
|
|
106
62
|
def make_request(self, method: str, path: str, **kwargs):
|
|
107
63
|
"""
|
|
108
64
|
Makes a request to the API
|
|
@@ -131,20 +87,6 @@ class Seam(AbstractSeam):
|
|
|
131
87
|
headers["seam-workspace"] = self.workspace_id
|
|
132
88
|
response = requests.request(method, url, headers=headers, **kwargs)
|
|
133
89
|
|
|
134
|
-
if self.should_report_exceptions and response.status_code:
|
|
135
|
-
# Add breadcrumb
|
|
136
|
-
self.sentry_client.add_breadcrumb(
|
|
137
|
-
category="http",
|
|
138
|
-
level="info",
|
|
139
|
-
data={
|
|
140
|
-
"method": method,
|
|
141
|
-
"url": url,
|
|
142
|
-
"status_code": response.status_code,
|
|
143
|
-
"request_id": response.headers.get("seam-request-id", "unknown"),
|
|
144
|
-
},
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
|
|
148
90
|
if response.status_code != 200:
|
|
149
91
|
raise SeamApiException(response)
|
|
150
92
|
|
|
@@ -9,6 +9,7 @@ import base_clientRbTemplate from "./templates/base_client.rb.template.js"
|
|
|
9
9
|
import readmeMdTemplate from "./templates/readme.md.template.js"
|
|
10
10
|
import rakefileTemplate from "./templates/rakefile.template.js"
|
|
11
11
|
import versionRbTemplate from "./templates/version.rb.template.js"
|
|
12
|
+
import ltsVersionRbTemplate from "./templates/lts_version.rb.template.js"
|
|
12
13
|
import requestRbTemplate from "./templates/request.rb.template.js"
|
|
13
14
|
import loggerRbTemplate from "./templates/logger.rb.template.js"
|
|
14
15
|
import clientRbTemplate from "./templates/client.rb.template.js"
|
|
@@ -46,6 +47,7 @@ export const generateRubySDK = async () => {
|
|
|
46
47
|
fs[".rspec"] = rspecTemplate()
|
|
47
48
|
fs[".ruby-version"] = rubyVersionTemplate()
|
|
48
49
|
fs["lib/seam/version.rb"] = versionRbTemplate()
|
|
50
|
+
fs["lib/seam/lts_version.rb"] = ltsVersionRbTemplate()
|
|
49
51
|
fs["lib/seam/request.rb"] = requestRbTemplate()
|
|
50
52
|
fs["lib/seam/logger.rb"] = loggerRbTemplate()
|
|
51
53
|
fs["lib/seam/clients/base_client.rb"] = base_clientRbTemplate()
|
|
@@ -59,6 +61,7 @@ export const generateRubySDK = async () => {
|
|
|
59
61
|
|
|
60
62
|
const seamapi_rb_requires = [
|
|
61
63
|
"seam/version",
|
|
64
|
+
"seam/lts_version",
|
|
62
65
|
"seam/request",
|
|
63
66
|
"seam/logger",
|
|
64
67
|
"seam/client",
|
|
@@ -179,7 +182,7 @@ export const generateRubySDK = async () => {
|
|
|
179
182
|
...seamapi_rb_requires.map((r) => `require_relative "${r}"`),
|
|
180
183
|
"",
|
|
181
184
|
`module Seam`,
|
|
182
|
-
`end`,
|
|
185
|
+
`end\n`,
|
|
183
186
|
].join("\n")
|
|
184
187
|
|
|
185
188
|
return fs
|
|
@@ -70,11 +70,12 @@ export class RubyClient {
|
|
|
70
70
|
),
|
|
71
71
|
...this.methods.map(
|
|
72
72
|
({ method_name, path, parameters, return_resource, return_path }) => {
|
|
73
|
-
const
|
|
73
|
+
const has_return_value = return_resource && return_path
|
|
74
|
+
const returns_deprecated_action_attempt =
|
|
75
|
+
endpoints_returning_deprecated_action_attempt.includes(path)
|
|
74
76
|
const can_method_poll_action_attempt =
|
|
75
|
-
|
|
76
|
-
!
|
|
77
|
-
return_resource === "ActionAttempt"
|
|
77
|
+
return_path === "action_attempt" &&
|
|
78
|
+
!returns_deprecated_action_attempt
|
|
78
79
|
|
|
79
80
|
return [
|
|
80
81
|
`def ${method_name}(${parameters
|
|
@@ -83,24 +84,31 @@ export class RubyClient {
|
|
|
83
84
|
(a.position ?? a.required ? 1000 : 9999) -
|
|
84
85
|
(b.position ?? b.required ? 1000 : 9999)
|
|
85
86
|
)
|
|
86
|
-
.map((p) => `${p.name}${p.required ? "" : ": nil"}`)
|
|
87
|
+
.map((p) => `${p.name}${p.required ? ":" : ": nil"}`)
|
|
88
|
+
.concat(
|
|
89
|
+
can_method_poll_action_attempt
|
|
90
|
+
? ["wait_for_action_attempt: nil"]
|
|
91
|
+
: []
|
|
92
|
+
)
|
|
87
93
|
.join(", ")})`,
|
|
88
94
|
` ${can_method_poll_action_attempt ? "action_attempt = " : ""}${
|
|
89
|
-
|
|
95
|
+
has_return_value ? "request_seam_object" : "request_seam"
|
|
90
96
|
}(`,
|
|
91
97
|
` :post,`,
|
|
92
98
|
` "${path}",`,
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
has_return_value
|
|
100
|
+
? ` Seam::${return_resource},\n '${return_path}',`
|
|
101
|
+
: [],
|
|
95
102
|
` body: {${parameters
|
|
96
103
|
.map((p) => `${p.name}: ${p.name}`)
|
|
97
104
|
.join(", ")}}.compact`,
|
|
98
|
-
` )`,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
` )\n`,
|
|
106
|
+
can_method_poll_action_attempt
|
|
107
|
+
? " action_attempt.decide_and_wait(wait_for_action_attempt)\n action_attempt"
|
|
108
|
+
: [],
|
|
109
|
+
!has_return_value || returns_deprecated_action_attempt
|
|
110
|
+
? " nil"
|
|
111
|
+
: [],
|
|
104
112
|
`end`,
|
|
105
113
|
``,
|
|
106
114
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default () => `3.0.4`
|
|
1
|
+
export default () => `3.0.4\n`
|