Skip to content

Commit aa02d28

Browse files
authored
Merge pull request #61 from Shopify/ap.rename-provider
Rename `shopify_function_wasm_api_provider` to `shopify_function_provider`
2 parents cb79b6f + f99351c commit aa02d28

File tree

8 files changed

+30
-43
lines changed

8 files changed

+30
-43
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
- name: Extract provider version
2525
id: provider_version
2626
run: |
27-
VERSION=$(cargo metadata --format-version=1 --locked | jq '.packages[] | select(.name == "shopify_function_wasm_api_provider") | .version' -r)
27+
VERSION=$(cargo metadata --format-version=1 --locked | jq '.packages[] | select(.name == "shopify_function_provider") | .version' -r)
2828
echo "version=$VERSION" >> $GITHUB_OUTPUT
2929
3030
- name: Build provider asset
31-
run: cargo build --release --target wasm32-wasip1 --package shopify_function_wasm_api_provider
31+
run: cargo build --release --target wasm32-wasip1 --package shopify_function_provider
3232

3333
- name: Archive asset
34-
run: gzip -k -f target/wasm32-wasip1/release/shopify_function_wasm_api_provider.wasm && mv target/wasm32-wasip1/release/shopify_function_wasm_api_provider.wasm.gz shopify_function_v${{ steps.provider_version.outputs.version }}.wasm.gz
34+
run: gzip -k -f target/wasm32-wasip1/release/shopify_function_provider.wasm && mv target/wasm32-wasip1/release/shopify_function_provider.wasm.gz shopify_function_v${{ steps.provider_version.outputs.version }}.wasm.gz
3535

3636
- name: Generate asset hash
3737
run: sha256sum shopify_function_v${{ steps.provider_version.outputs.version }}.wasm.gz | awk '{ print $1 }' > shopify_function_v${{ steps.provider_version.outputs.version }}.wasm.gz.sha256

api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ shopify_function_wasm_api_core = { path = "../core", version = "0.0.1" }
1212
thiserror = "2.0"
1313

1414
[target.'cfg(not(target_family = "wasm"))'.dependencies]
15-
shopify_function_wasm_api_provider = { path = "../provider", version = "1.0.0" }
15+
shopify_function_provider = { path = "../provider", version = "1.0.0" }
1616
serde_json = "1.0"
1717
rmp-serde = "1.3"
1818

api/src/lib.rs

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ mod provider_fallback {
9696

9797
// Read API.
9898
pub(crate) unsafe fn shopify_function_input_get(context: ContextPtr) -> Val {
99-
shopify_function_wasm_api_provider::read::shopify_function_input_get(context)
99+
shopify_function_provider::read::shopify_function_input_get(context)
100100
}
101101
pub(crate) unsafe fn shopify_function_input_get_val_len(
102102
context: ContextPtr,
103103
scope: Val,
104104
) -> usize {
105-
shopify_function_wasm_api_provider::read::shopify_function_input_get_val_len(context, scope)
105+
shopify_function_provider::read::shopify_function_input_get_val_len(context, scope)
106106
}
107107
pub(crate) unsafe fn shopify_function_input_read_utf8_str(
108108
context: ContextPtr,
@@ -111,9 +111,7 @@ mod provider_fallback {
111111
len: usize,
112112
) {
113113
let src =
114-
shopify_function_wasm_api_provider::read::shopify_function_input_get_utf8_str_addr(
115-
context, src,
116-
);
114+
shopify_function_provider::read::shopify_function_input_get_utf8_str_addr(context, src);
117115
std::ptr::copy(src as _, out, len);
118116
}
119117
pub(crate) unsafe fn shopify_function_input_get_obj_prop(
@@ -122,7 +120,7 @@ mod provider_fallback {
122120
ptr: *const u8,
123121
len: usize,
124122
) -> Val {
125-
shopify_function_wasm_api_provider::read::shopify_function_input_get_obj_prop(
123+
shopify_function_provider::read::shopify_function_input_get_obj_prop(
126124
context, scope, ptr as _, len,
127125
)
128126
}
@@ -131,7 +129,7 @@ mod provider_fallback {
131129
scope: Val,
132130
interned_string_id: shopify_function_wasm_api_core::InternedStringId,
133131
) -> Val {
134-
shopify_function_wasm_api_provider::read::shopify_function_input_get_interned_obj_prop(
132+
shopify_function_provider::read::shopify_function_input_get_interned_obj_prop(
135133
context,
136134
scope,
137135
interned_string_id,
@@ -142,16 +140,14 @@ mod provider_fallback {
142140
scope: Val,
143141
index: usize,
144142
) -> Val {
145-
shopify_function_wasm_api_provider::read::shopify_function_input_get_at_index(
146-
context, scope, index,
147-
)
143+
shopify_function_provider::read::shopify_function_input_get_at_index(context, scope, index)
148144
}
149145
pub(crate) unsafe fn shopify_function_input_get_obj_key_at_index(
150146
context: ContextPtr,
151147
scope: Val,
152148
index: usize,
153149
) -> Val {
154-
shopify_function_wasm_api_provider::read::shopify_function_input_get_obj_key_at_index(
150+
shopify_function_provider::read::shopify_function_input_get_obj_key_at_index(
155151
context, scope, index,
156152
)
157153
}
@@ -161,35 +157,33 @@ mod provider_fallback {
161157
context: ContextPtr,
162158
bool: u32,
163159
) -> WriteResult {
164-
shopify_function_wasm_api_provider::write::shopify_function_output_new_bool(context, bool)
160+
shopify_function_provider::write::shopify_function_output_new_bool(context, bool)
165161
}
166162
pub(crate) unsafe fn shopify_function_output_new_null(context: ContextPtr) -> WriteResult {
167-
shopify_function_wasm_api_provider::write::shopify_function_output_new_null(context)
163+
shopify_function_provider::write::shopify_function_output_new_null(context)
168164
}
169165
pub(crate) unsafe fn shopify_function_output_finalize(context: ContextPtr) -> WriteResult {
170-
shopify_function_wasm_api_provider::write::shopify_function_output_finalize(context)
166+
shopify_function_provider::write::shopify_function_output_finalize(context)
171167
}
172168
pub(crate) unsafe fn shopify_function_output_new_i32(
173169
context: ContextPtr,
174170
int: i32,
175171
) -> WriteResult {
176-
shopify_function_wasm_api_provider::write::shopify_function_output_new_i32(context, int)
172+
shopify_function_provider::write::shopify_function_output_new_i32(context, int)
177173
}
178174
pub(crate) unsafe fn shopify_function_output_new_f64(
179175
context: ContextPtr,
180176
float: f64,
181177
) -> WriteResult {
182-
shopify_function_wasm_api_provider::write::shopify_function_output_new_f64(context, float)
178+
shopify_function_provider::write::shopify_function_output_new_f64(context, float)
183179
}
184180
pub(crate) unsafe fn shopify_function_output_new_utf8_str(
185181
context: ContextPtr,
186182
ptr: *const u8,
187183
len: usize,
188184
) -> WriteResult {
189185
let result =
190-
shopify_function_wasm_api_provider::write::shopify_function_output_new_utf8_str(
191-
context, len,
192-
);
186+
shopify_function_provider::write::shopify_function_output_new_utf8_str(context, len);
193187
let write_result =
194188
WriteResult::from_repr((result >> usize::BITS) as usize).expect("Invalid write result");
195189
let dst = result as usize;
@@ -202,27 +196,25 @@ mod provider_fallback {
202196
context: ContextPtr,
203197
id: shopify_function_wasm_api_core::InternedStringId,
204198
) -> WriteResult {
205-
shopify_function_wasm_api_provider::write::shopify_function_output_new_interned_utf8_str(
206-
context, id,
207-
)
199+
shopify_function_provider::write::shopify_function_output_new_interned_utf8_str(context, id)
208200
}
209201
pub(crate) unsafe fn shopify_function_output_new_object(
210202
context: ContextPtr,
211203
len: usize,
212204
) -> WriteResult {
213-
shopify_function_wasm_api_provider::write::shopify_function_output_new_object(context, len)
205+
shopify_function_provider::write::shopify_function_output_new_object(context, len)
214206
}
215207
pub(crate) unsafe fn shopify_function_output_finish_object(context: ContextPtr) -> WriteResult {
216-
shopify_function_wasm_api_provider::write::shopify_function_output_finish_object(context)
208+
shopify_function_provider::write::shopify_function_output_finish_object(context)
217209
}
218210
pub(crate) unsafe fn shopify_function_output_new_array(
219211
context: ContextPtr,
220212
len: usize,
221213
) -> WriteResult {
222-
shopify_function_wasm_api_provider::write::shopify_function_output_new_array(context, len)
214+
shopify_function_provider::write::shopify_function_output_new_array(context, len)
223215
}
224216
pub(crate) unsafe fn shopify_function_output_finish_array(context: ContextPtr) -> WriteResult {
225-
shopify_function_wasm_api_provider::write::shopify_function_output_finish_array(context)
217+
shopify_function_provider::write::shopify_function_output_finish_array(context)
226218
}
227219

228220
// Other.
@@ -231,8 +223,7 @@ mod provider_fallback {
231223
ptr: *const u8,
232224
len: usize,
233225
) -> usize {
234-
let result =
235-
shopify_function_wasm_api_provider::shopify_function_intern_utf8_str(context, len);
226+
let result = shopify_function_provider::shopify_function_intern_utf8_str(context, len);
236227
let id = (result >> usize::BITS) as usize;
237228
let dst = result as usize;
238229
std::ptr::copy(ptr as _, dst as _, len);
@@ -498,11 +489,7 @@ impl Context {
498489
#[cfg(not(target_family = "wasm"))]
499490
pub fn new_with_input(input: serde_json::Value) -> Self {
500491
let bytes = rmp_serde::to_vec(&input).unwrap();
501-
Self(
502-
shopify_function_wasm_api_provider::shopify_function_context_new_from_msgpack_bytes(
503-
bytes,
504-
),
505-
)
492+
Self(shopify_function_provider::shopify_function_context_new_from_msgpack_bytes(bytes))
506493
}
507494

508495
/// Get the top-level value of the input.

api/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl Context {
119119
/// Finalize the output and return the serialized value as a `serde_json::Value`.
120120
/// This is only available in non-WASM targets, and therefore only recommended for use in tests.
121121
pub fn finalize_output_and_return(self) -> Result<serde_json::Value, Error> {
122-
let (result, bytes) = shopify_function_wasm_api_provider::write::shopify_function_output_finalize_and_return_msgpack_bytes(self.0 as _);
122+
let (result, bytes) = shopify_function_provider::write::shopify_function_output_finalize_and_return_msgpack_bytes(self.0 as _);
123123
map_result(result).and_then(|_| rmp_serde::from_slice(&bytes).map_err(|_| Error::IoError))
124124
}
125125
}

integration_tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ deterministic-wasi-ctx = "1.0.0"
1111
rmp-serde = "1.3"
1212
serde_json = "1.0"
1313
shopify_function_trampoline = { path = "../trampoline" }
14-
shopify_function_wasm_api_provider = { path = "../provider" }
14+
shopify_function_provider = { path = "../provider" }

integration_tests/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn build_provider() -> Result<()> {
1616
"--target",
1717
"wasm32-wasip1",
1818
"-p",
19-
"shopify_function_wasm_api_provider",
19+
"shopify_function_provider",
2020
])
2121
.status()?;
2222
if !status.success() {

integration_tests/tests/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn run_example_with_input(example: &str, input: serde_json::Value) -> Result<Vec
1919
)?;
2020
let provider = Module::from_file(
2121
&engine,
22-
workspace_root.join("target/wasm32-wasip1/release/shopify_function_wasm_api_provider.wasm"),
22+
workspace_root.join("target/wasm32-wasip1/release/shopify_function_provider.wasm"),
2323
)?;
2424

2525
let input = rmp_serde::to_vec(&input)?;
@@ -50,7 +50,7 @@ fn run_example_with_input(example: &str, input: serde_json::Value) -> Result<Vec
5050
let provider_instance = linker.instantiate(&mut store, &provider)?;
5151
linker.instance(
5252
&mut store,
53-
shopify_function_wasm_api_provider::PROVIDER_MODULE_NAME,
53+
shopify_function_provider::PROVIDER_MODULE_NAME,
5454
provider_instance,
5555
)?;
5656

provider/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "shopify_function_wasm_api_provider"
2+
name = "shopify_function_provider"
33
version = "1.0.0"
44
edition = "2021"
55
license = "MIT"

0 commit comments

Comments
 (0)