File tree Expand file tree Collapse file tree 9 files changed +118
-86
lines changed
javascript/local-pickup-delivery-option-generators/default
rust/local-pickup-delivery-option-generators/default Expand file tree Collapse file tree 9 files changed +118
-86
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "name": "{{name }}",
3
+ "description": "{{name }}"
4
+ }
Original file line number Diff line number Diff line change 11
11
},
12
12
"codegen": {
13
13
"schema": "schema.graphql",
14
- "documents": "input .graphql",
14
+ "documents": "src/* .graphql",
15
15
"generates": {
16
16
"./generated/api.ts": {
17
17
"plugins": [
18
18
"typescript",
19
19
"typescript-operations"
20
20
]
21
21
}
22
+ },
23
+ "config": {
24
+ "omitOperationSuffix": true
22
25
}
23
26
},
24
27
"devDependencies": {
Original file line number Diff line number Diff line change 1
- name = "{{name }}"
2
- type = "local_pickup_delivery_option_generator"
3
- {% if uid %}uid = "{{ uid }}"{% endif %}
4
1
api_version = "unstable"
5
2
6
- [build]
7
- command = ""
8
- path = "dist/function.wasm"
3
+ [[extensions]]
4
+ name = "t:name"
5
+ handle = "{{handle }}"
6
+ type = "function"
7
+ {% if uid %}uid = "{{ uid }}"{% endif %}
8
+
9
+ [[extensions.targeting]]
10
+ target = "purchase.local-pickup-delivery-option-generator.run"
11
+ input_query = "src/run.graphql"
12
+ export = "run"
13
+
14
+ [extensions.build]
15
+ command = ""
16
+ path = "dist/function.wasm"
17
+
18
+ [extensions.ui.paths]
19
+ create = "/"
20
+ details = "/"
Original file line number Diff line number Diff line change 1
- {%- if flavor contains "vanilla-js" -%}
2
- // @ts-check
3
-
4
- /**
5
- * @typedef {import("../generated/api").InputQuery} InputQuery
6
- * @typedef {import("../generated/api").FunctionResult} FunctionResult
7
- */
8
-
9
- /**
10
- * @type {FunctionResult}
11
- */
12
- const DELIVERY_OPTION = {
13
- operations: [
14
- {
15
- add: {
16
- title: "Main St.",
17
- cost: 1.99,
18
- pickupLocation: {
19
- locationHandle: "2578303",
20
- pickupInstruction: "Usually ready in 24 hours."
21
- }
22
- }
23
- }
24
- ],
25
- };
26
-
27
- export default /**
28
- * @param {InputQuery} input
29
- * @returns {FunctionResult}
30
- */
31
- (input) => {
32
- const configuration = JSON.parse(
33
- input?.deliveryOptionGenerator?.metafield?.value ?? "{}"
34
- );
35
-
36
- return DELIVERY_OPTION;
37
- };
38
- {%- elsif flavor contains "typescript" -%}
39
- import {
40
- InputQuery,
41
- FunctionResult,
42
- } from "../generated/api";
43
-
44
- const DELIVERY_OPTION: FunctionResult = {
45
- operations: [
46
- {
47
- add: {
48
- title: "Main St.",
49
- cost: 1.99,
50
- pickupLocation: {
51
- locationHandle: "2578303",
52
- pickupInstruction: "Usually ready in 24 hours."
53
- }
54
- }
55
- }
56
- ],
57
- };
58
-
59
- type Configuration = {};
60
-
61
- export default (input: InputQuery): FunctionResult => {
62
- const configuration: Configuration = JSON.parse(
63
- input?.deliveryOptionGenerator?.metafield?.value ?? "{}"
64
- );
65
- return DELIVERY_OPTION;
66
- };
67
- {%- endif -%}
1
+ export * from './run';
Original file line number Diff line number Diff line change 1
- query Input {
1
+ query RunInput {
2
2
cart {
3
3
lines {
4
4
id
Original file line number Diff line number Diff line change
1
+ {%- if flavor contains "vanilla-js" -%}
2
+ // @ts-check
3
+
4
+ /**
5
+ * @typedef {import("../generated/api").InputQuery} InputQuery
6
+ * @typedef {import("../generated/api").FunctionResult} FunctionResult
7
+ */
8
+
9
+ /**
10
+ * @type {FunctionResult}
11
+ */
12
+ const DELIVERY_OPTION = {
13
+ operations: [
14
+ {
15
+ add: {
16
+ title: "Main St.",
17
+ cost: 1.99,
18
+ pickupLocation: {
19
+ locationHandle: "2578303",
20
+ pickupInstruction: "Usually ready in 24 hours."
21
+ }
22
+ }
23
+ }
24
+ ],
25
+ };
26
+
27
+ export default /**
28
+ * @param {InputQuery} input
29
+ * @returns {FunctionResult}
30
+ */
31
+ (input) => {
32
+ const configuration = JSON.parse(
33
+ input?.deliveryOptionGenerator?.metafield?.value ?? "{}"
34
+ );
35
+
36
+ return DELIVERY_OPTION;
37
+ };
38
+ {%- elsif flavor contains "typescript" -%}
39
+ import {
40
+ InputQuery,
41
+ FunctionResult,
42
+ } from "../generated/api";
43
+
44
+ const DELIVERY_OPTION: FunctionResult = {
45
+ operations: [
46
+ {
47
+ add: {
48
+ title: "Main St.",
49
+ cost: 1.99,
50
+ pickupLocation: {
51
+ locationHandle: "2578303",
52
+ pickupInstruction: "Usually ready in 24 hours."
53
+ }
54
+ }
55
+ }
56
+ ],
57
+ };
58
+
59
+ type Configuration = {};
60
+
61
+ export default (input: InputQuery): FunctionResult => {
62
+ const configuration: Configuration = JSON.parse(
63
+ input?.deliveryOptionGenerator?.metafield?.value ?? "{}"
64
+ );
65
+ return DELIVERY_OPTION;
66
+ };
67
+ {%- endif -%}
Original file line number Diff line number Diff line change 1
1
{%- if flavor contains "vanilla-js" -%}
2
2
import { describe, it, expect } from 'vitest';
3
- import deliveryOptionGenerator from './index ';
3
+ import deliveryOptionGenerator from './run ';
4
4
5
5
/**
6
6
* @typedef {import("../generated/api").FunctionResult} FunctionResult
Original file line number Diff line number Diff line change
1
+ {
2
+ "name": "{{name }}",
3
+ "description": "{{name }}"
4
+ }
Original file line number Diff line number Diff line change 1
- name = "{{name }}"
2
- type = "local_pickup_delivery_option_generator"
3
- {% if uid %}uid = "{{ uid }}"{% endif %}
4
1
api_version = "unstable"
5
2
6
- [build]
7
- command = "cargo build --target=wasm32-wasip1 --release"
8
- path = "target/wasm32-wasip1/release/{{name | replace: " " , "-" | downcase }}.wasm"
9
- watch = [ "src/**/*.rs" ]
3
+ [[extensions]]
4
+ name = "t:name"
5
+ handle = "{{handle }}"
6
+ type = "function"
7
+ {% if uid %}uid = "{{ uid }}"{% endif %}
8
+
9
+ [[extensions.targeting]]
10
+ target = "purchase.local-pickup-delivery-option-generator.run"
11
+ input_query = "src/run.graphql"
12
+ export = "run"
13
+
14
+ [extensions.build]
15
+ command = "cargo build --target=wasm32-wasip1 --release"
16
+ path = "target/wasm32-wasip1/release/{{handle | replace: " " , "-" | downcase }}.wasm"
17
+ watch = [ "src/**/*.rs" ]
10
18
11
- [ ui.paths]
12
- create = "/"
13
- details = "/"
19
+ [extensions. ui.paths]
20
+ create = "/"
21
+ details = "/"
You can’t perform that action at this time.
0 commit comments