@friggframework/core 2.0.0--canary.700.80ec1cc.0 → 2.0.0--canary.702.047d3c4.0
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/database/documentdb-utils.js +1 -6
- package/errors/index.js +0 -4
- package/generated/prisma-mongodb/edge.js +4 -52
- package/generated/prisma-mongodb/index-browser.js +1 -49
- package/generated/prisma-mongodb/index.d.ts +60 -3506
- package/generated/prisma-mongodb/index.js +4 -52
- package/generated/prisma-mongodb/package.json +1 -1
- package/generated/prisma-mongodb/schema.prisma +0 -65
- package/generated/prisma-mongodb/wasm.js +4 -52
- package/generated/prisma-postgresql/edge.js +4 -52
- package/generated/prisma-postgresql/index-browser.js +1 -49
- package/generated/prisma-postgresql/index.d.ts +94 -3824
- package/generated/prisma-postgresql/index.js +4 -52
- package/generated/prisma-postgresql/package.json +1 -1
- package/generated/prisma-postgresql/schema.prisma +0 -63
- package/generated/prisma-postgresql/wasm.js +4 -52
- package/handlers/WEBHOOKS.md +0 -29
- package/handlers/app-definition-loader.js +9 -2
- package/handlers/app-handler-helpers.js +2 -5
- package/handlers/integration-event-dispatcher.js +3 -7
- package/handlers/routers/integration-webhook-routers.js +38 -26
- package/index.js +0 -2
- package/integrations/integration-base.js +1 -162
- package/integrations/integration-router.js +1 -6
- package/integrations/repositories/integration-mapping-repository-documentdb.js +0 -50
- package/integrations/repositories/integration-mapping-repository-interface.js +0 -15
- package/integrations/repositories/integration-mapping-repository-mongo.js +0 -29
- package/integrations/repositories/integration-mapping-repository-postgres.js +0 -30
- package/integrations/repositories/integration-mapping-repository.js +0 -29
- package/integrations/repositories/integration-repository-documentdb.js +2 -6
- package/integrations/repositories/integration-repository-interface.js +0 -3
- package/integrations/repositories/integration-repository-mongo.js +5 -20
- package/integrations/repositories/integration-repository-postgres.js +1 -5
- package/integrations/repositories/process-repository-mongo.js +1 -1
- package/integrations/use-cases/create-integration.js +4 -14
- package/integrations/use-cases/delete-integration-for-user.js +4 -4
- package/integrations/use-cases/get-integration-for-user.js +2 -4
- package/integrations/use-cases/get-integration-instance.js +4 -4
- package/integrations/use-cases/get-integrations-for-user.js +4 -4
- package/integrations/use-cases/get-possible-integrations.js +2 -7
- package/integrations/use-cases/update-integration.js +4 -4
- package/package.json +6 -6
- package/prisma-mongodb/schema.prisma +0 -65
- package/prisma-postgresql/schema.prisma +0 -63
- package/queues/queuer-util.js +2 -9
- package/errors/mapping-already-exists-error.js +0 -14
- package/handlers/workers/integration-triggers.js +0 -25
- package/infrastructure/scheduler/recurrence.js +0 -204
- package/integrations/definitions/README.md +0 -278
- package/integrations/definitions/canonical.js +0 -11
- package/integrations/definitions/capabilities/AUDIT.md +0 -480
- package/integrations/definitions/capabilities/acmeerp.capabilities.json +0 -633
- package/integrations/definitions/capabilities/asana.capabilities.json +0 -279
- package/integrations/definitions/capabilities/calendly.capabilities.json +0 -385
- package/integrations/definitions/capabilities/docusign.capabilities.json +0 -314
- package/integrations/definitions/capabilities/fathom.capabilities.json +0 -238
- package/integrations/definitions/capabilities/github.capabilities.json +0 -585
- package/integrations/definitions/capabilities/hubspot.capabilities.json +0 -822
- package/integrations/definitions/capabilities/jira.capabilities.json +0 -391
- package/integrations/definitions/capabilities/klaviyo.capabilities.json +0 -503
- package/integrations/definitions/capabilities/linear.capabilities.json +0 -378
- package/integrations/definitions/capabilities/netsuite.capabilities.json +0 -535
- package/integrations/definitions/capabilities/notion.capabilities.json +0 -208
- package/integrations/definitions/capabilities/phone.capabilities.json +0 -511
- package/integrations/definitions/capabilities/pipedrive.capabilities.json +0 -430
- package/integrations/definitions/capabilities/quickbooks.capabilities.json +0 -635
- package/integrations/definitions/capabilities/salesforce.capabilities.json +0 -568
- package/integrations/definitions/capabilities/shopify.capabilities.json +0 -1128
- package/integrations/definitions/capabilities/slack.capabilities.json +0 -373
- package/integrations/definitions/capabilities/stripe.capabilities.json +0 -630
- package/integrations/definitions/capabilities/webflow.capabilities.json +0 -196
- package/integrations/definitions/capabilities/zendesk.capabilities.json +0 -422
- package/integrations/definitions/compile.js +0 -80
- package/integrations/definitions/config-form.js +0 -137
- package/integrations/definitions/examples/acme-erp-quickbooks.definition.json +0 -467
- package/integrations/definitions/examples/asana-slack.definition.json +0 -219
- package/integrations/definitions/examples/calendly-salesforce.definition.json +0 -459
- package/integrations/definitions/examples/docusign-salesforce.definition.json +0 -305
- package/integrations/definitions/examples/fathom-hubspot-notion.definition.json +0 -575
- package/integrations/definitions/examples/github-linear.definition.json +0 -322
- package/integrations/definitions/examples/hubspot-slack.definition.json +0 -427
- package/integrations/definitions/examples/klaviyo-hubspot.definition.json +0 -336
- package/integrations/definitions/examples/phone-hubspot.definition.json +0 -633
- package/integrations/definitions/examples/pipedrive-hubspot.definition.json +0 -136
- package/integrations/definitions/examples/pipedrive-phone.definition.json +0 -340
- package/integrations/definitions/examples/records/phone-hubspot.definition-version.json +0 -652
- package/integrations/definitions/examples/records/phone-hubspot.integration.json +0 -86
- package/integrations/definitions/examples/records/phone-hubspot.mappings.json +0 -39
- package/integrations/definitions/examples/records/phone-hubspot.workflow-run.json +0 -62
- package/integrations/definitions/examples/shopify-klaviyo.definition.json +0 -488
- package/integrations/definitions/examples/shopify-netsuite.definition.json +0 -622
- package/integrations/definitions/examples/stripe-quickbooks.definition.json +0 -476
- package/integrations/definitions/examples/webflow-hubspot-slack.definition.json +0 -262
- package/integrations/definitions/examples/zendesk-jira.definition.json +0 -604
- package/integrations/definitions/expressions.js +0 -229
- package/integrations/definitions/index.js +0 -45
- package/integrations/definitions/integration-runtime.js +0 -763
- package/integrations/definitions/interpreter.js +0 -104
- package/integrations/definitions/manifests.js +0 -177
- package/integrations/definitions/renderers/common.js +0 -67
- package/integrations/definitions/renderers/html.js +0 -129
- package/integrations/definitions/renderers/hubspot.js +0 -59
- package/integrations/definitions/renderers/preview.js +0 -154
- package/integrations/definitions/renderers/slack.js +0 -146
- package/integrations/definitions/repositories/definition-version-repository.js +0 -67
- package/integrations/definitions/repositories/workflow-run-repository.js +0 -80
- package/integrations/definitions/router.js +0 -170
- package/integrations/definitions/runtime.js +0 -268
- package/integrations/definitions/schema/capability-manifest.v0.1.schema.json +0 -549
- package/integrations/definitions/schema/installation.v0.1.schema.json +0 -130
- package/integrations/definitions/schema/integration-definition.v0.1.schema.json +0 -909
- package/integrations/definitions/schema/records.md +0 -105
- package/integrations/definitions/schema-check.js +0 -58
- package/integrations/definitions/scripts/check-manifests.js +0 -220
- package/integrations/definitions/scripts/validate.js +0 -66
- package/integrations/definitions/steps.js +0 -123
- package/integrations/definitions/sync-engine.js +0 -297
- package/integrations/definitions/tests/helpers-fake-crm.js +0 -49
- package/integrations/definitions/transforms.js +0 -91
- package/integrations/definitions/use-cases/definition-use-cases.js +0 -245
- package/integrations/definitions/validate.js +0 -436
- package/integrations/definitions/versioning.js +0 -176
- package/integrations/definitions/webhooks.js +0 -119
- package/integrations/integration-types.js +0 -64
- package/integrations/triggers.js +0 -244
- package/integrations/use-cases/run-trigger-tick.js +0 -155
- package/integrations/use-cases/run-trigger.js +0 -77
- package/prisma-postgresql/migrations/20261018000000_add_data_defined_integrations/migration.sql +0 -66
- package/prisma-postgresql/migrations/20261019000000_workflow_run_waits/migration.sql +0 -7
- package/prisma-postgresql/migrations/20261019120000_definition_workspace/migration.sql +0 -5
|
@@ -1,622 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://friggframework.org/schemas/integration-definition/v0.1.json",
|
|
3
|
-
"schemaVersion": "0.1",
|
|
4
|
-
"id": "shopify-netsuite",
|
|
5
|
-
"version": "2.2.0",
|
|
6
|
-
"display": {
|
|
7
|
-
"label": "Shopify \u2192 NetSuite",
|
|
8
|
-
"description": "Paid Shopify orders become NetSuite sales orders, customers follow them, NetSuite fulfillments write tracking back to Shopify, refunds become credit memos, and low stock is announced in Slack.",
|
|
9
|
-
"category": "ERP",
|
|
10
|
-
"tags": [
|
|
11
|
-
"ecommerce",
|
|
12
|
-
"erp",
|
|
13
|
-
"order-to-cash",
|
|
14
|
-
"inventory"
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
"modules": {
|
|
18
|
-
"shopify": {
|
|
19
|
-
"module": "shopify",
|
|
20
|
-
"version": "^3.1"
|
|
21
|
-
},
|
|
22
|
-
"netsuite": {
|
|
23
|
-
"module": "netsuite",
|
|
24
|
-
"version": "^1.2"
|
|
25
|
-
},
|
|
26
|
-
"slack": {
|
|
27
|
-
"module": "slack",
|
|
28
|
-
"version": "^2.0"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"settings": {
|
|
32
|
-
"subsidiary": {
|
|
33
|
-
"type": "option",
|
|
34
|
-
"options": "netsuite.subsidiary",
|
|
35
|
-
"label": "NetSuite subsidiary for new customers and orders",
|
|
36
|
-
"required": true
|
|
37
|
-
},
|
|
38
|
-
"location": {
|
|
39
|
-
"type": "option",
|
|
40
|
-
"options": "netsuite.location",
|
|
41
|
-
"label": "Fulfil Shopify orders from",
|
|
42
|
-
"required": true
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"syncs": [
|
|
46
|
-
{
|
|
47
|
-
"id": "customers",
|
|
48
|
-
"label": "Customers",
|
|
49
|
-
"description": "Every Shopify customer exists in NetSuite as an individual customer, matched by email.",
|
|
50
|
-
"source": "shopify.customer",
|
|
51
|
-
"target": "netsuite.customer",
|
|
52
|
-
"direction": "one_way",
|
|
53
|
-
"identity": {
|
|
54
|
-
"match": [
|
|
55
|
-
{
|
|
56
|
-
"source": "email",
|
|
57
|
-
"target": "email",
|
|
58
|
-
"transform": "lowercase",
|
|
59
|
-
"key": "email"
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
"onAmbiguous": "first"
|
|
63
|
-
},
|
|
64
|
-
"mapping": [
|
|
65
|
-
{
|
|
66
|
-
"source": "first_name",
|
|
67
|
-
"target": "firstName"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"source": "last_name",
|
|
71
|
-
"target": "lastName"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"source": "email",
|
|
75
|
-
"target": "email",
|
|
76
|
-
"transform": "lowercase"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"source": "phone",
|
|
80
|
-
"target": "phone",
|
|
81
|
-
"transform": "to_e164_phone"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"source": "default_address.company",
|
|
85
|
-
"target": "companyName"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"source": "id",
|
|
89
|
-
"target": "externalId",
|
|
90
|
-
"transform": "none"
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
"filter": "$.record.email exists",
|
|
94
|
-
"backfill": {
|
|
95
|
-
"trigger": "userAction",
|
|
96
|
-
"pageSize": 250
|
|
97
|
-
},
|
|
98
|
-
"ongoing": {
|
|
99
|
-
"mode": "webhook"
|
|
100
|
-
},
|
|
101
|
-
"default": "on"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"id": "orders",
|
|
105
|
-
"label": "Orders",
|
|
106
|
-
"description": "Paid orders become sales orders. The header is mapped here; lines and the customer are filled in by the \"Sales order lines\" workflow.",
|
|
107
|
-
"source": "shopify.order",
|
|
108
|
-
"target": "netsuite.salesOrder",
|
|
109
|
-
"direction": "one_way",
|
|
110
|
-
"identity": {
|
|
111
|
-
"match": [
|
|
112
|
-
{
|
|
113
|
-
"source": "name",
|
|
114
|
-
"target": "otherRefNum",
|
|
115
|
-
"key": "orderNumber"
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
"onAmbiguous": "skip"
|
|
119
|
-
},
|
|
120
|
-
"mapping": [
|
|
121
|
-
{
|
|
122
|
-
"source": "name",
|
|
123
|
-
"target": "otherRefNum"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"source": "id",
|
|
127
|
-
"target": "externalId"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"source": "created_at",
|
|
131
|
-
"target": "tranDate",
|
|
132
|
-
"transform": "to_iso_date"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"source": "email",
|
|
136
|
-
"target": "email",
|
|
137
|
-
"transform": "lowercase"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"source": "currency",
|
|
141
|
-
"target": "currency.refName",
|
|
142
|
-
"transform": "uppercase"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"source": "note",
|
|
146
|
-
"target": "memo",
|
|
147
|
-
"transform": "default",
|
|
148
|
-
"options": {
|
|
149
|
-
"value": "Shopify order"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
],
|
|
153
|
-
"filter": "$.record.financial_status == 'paid' || $.record.financial_status == 'partially_refunded'",
|
|
154
|
-
"backfill": {
|
|
155
|
-
"trigger": "userAction",
|
|
156
|
-
"pageSize": 50
|
|
157
|
-
},
|
|
158
|
-
"ongoing": {
|
|
159
|
-
"mode": "webhook"
|
|
160
|
-
},
|
|
161
|
-
"default": "on"
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
"workflows": [
|
|
165
|
-
{
|
|
166
|
-
"id": "order-lines",
|
|
167
|
-
"label": "Sales order lines and customer",
|
|
168
|
-
"description": "After a sales order is created from a Shopify order, attach the NetSuite customer and turn Shopify line items, shipping and discounts into NetSuite item lines.",
|
|
169
|
-
"purpose": "write",
|
|
170
|
-
"default": "on",
|
|
171
|
-
"trigger": {
|
|
172
|
-
"type": "syncRecord",
|
|
173
|
-
"sync": "orders",
|
|
174
|
-
"on": [
|
|
175
|
-
"created"
|
|
176
|
-
]
|
|
177
|
-
},
|
|
178
|
-
"steps": [
|
|
179
|
-
{
|
|
180
|
-
"id": "order",
|
|
181
|
-
"use": "links.find",
|
|
182
|
-
"with": {
|
|
183
|
-
"sync": "orders",
|
|
184
|
-
"from": "shopify",
|
|
185
|
-
"id": "$.record.id"
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
"id": "customer",
|
|
190
|
-
"use": "links.find",
|
|
191
|
-
"with": {
|
|
192
|
-
"sync": "customers",
|
|
193
|
-
"key": {
|
|
194
|
-
"email": "$.record.email"
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"use": "stop",
|
|
200
|
-
"when": "$.steps.order == null || $.steps.customer == null",
|
|
201
|
-
"with": {
|
|
202
|
-
"reason": "Order or customer is not linked yet; the queue will retry"
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"id": "lines",
|
|
207
|
-
"use": "code",
|
|
208
|
-
"with": {
|
|
209
|
-
"ref": "@acme/commerce-steps#netsuiteItemLines@1.2.0",
|
|
210
|
-
"with": {
|
|
211
|
-
"lineItems": "$.record.line_items",
|
|
212
|
-
"shipping": "$.record.total_shipping_price_set.shop_money.amount",
|
|
213
|
-
"discountCodes": "$.record.discount_codes",
|
|
214
|
-
"locationId": "$.install.location"
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
"use": "netsuite.salesOrder.update",
|
|
220
|
-
"with": {
|
|
221
|
-
"id": "$.steps.order.netsuite",
|
|
222
|
-
"record": {
|
|
223
|
-
"entity": {
|
|
224
|
-
"id": "$.steps.customer.netsuite"
|
|
225
|
-
},
|
|
226
|
-
"subsidiary": {
|
|
227
|
-
"id": "$.install.subsidiary"
|
|
228
|
-
},
|
|
229
|
-
"location": {
|
|
230
|
-
"id": "$.install.location"
|
|
231
|
-
},
|
|
232
|
-
"item": {
|
|
233
|
-
"items": "$.steps.lines.items"
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
],
|
|
239
|
-
"retry": {
|
|
240
|
-
"max": 5,
|
|
241
|
-
"backoff": "exponential"
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
"id": "fulfillment-to-shopify",
|
|
246
|
-
"label": "Write NetSuite fulfillments back to Shopify",
|
|
247
|
-
"description": "When NetSuite ships an item fulfillment, fulfil the matching Shopify fulfillment orders with the tracking number.",
|
|
248
|
-
"purpose": "write",
|
|
249
|
-
"default": "on",
|
|
250
|
-
"settings": {
|
|
251
|
-
"carrier": {
|
|
252
|
-
"type": "enum",
|
|
253
|
-
"label": "Carrier shown to customers",
|
|
254
|
-
"enum": [
|
|
255
|
-
"UPS",
|
|
256
|
-
"USPS",
|
|
257
|
-
"FedEx",
|
|
258
|
-
"DHL Express",
|
|
259
|
-
"Other"
|
|
260
|
-
],
|
|
261
|
-
"default": "UPS"
|
|
262
|
-
},
|
|
263
|
-
"notifyCustomer": {
|
|
264
|
-
"type": "boolean",
|
|
265
|
-
"label": "Send Shopify's shipping confirmation email",
|
|
266
|
-
"default": true
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
"trigger": {
|
|
270
|
-
"type": "webhook",
|
|
271
|
-
"module": "netsuite",
|
|
272
|
-
"topic": "itemFulfillment.created",
|
|
273
|
-
"filter": "$.record.shipStatus == '_shipped'"
|
|
274
|
-
},
|
|
275
|
-
"steps": [
|
|
276
|
-
{
|
|
277
|
-
"id": "order",
|
|
278
|
-
"use": "links.find",
|
|
279
|
-
"with": {
|
|
280
|
-
"sync": "orders",
|
|
281
|
-
"from": "netsuite",
|
|
282
|
-
"id": "$.record.createdFrom.id"
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"use": "stop",
|
|
287
|
-
"when": "$.steps.order == null",
|
|
288
|
-
"with": {
|
|
289
|
-
"reason": "Fulfillment is for a sales order that did not come from Shopify"
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
"id": "fulfillmentOrders",
|
|
294
|
-
"use": "shopify.order.fulfillmentOrders",
|
|
295
|
-
"with": {
|
|
296
|
-
"orderId": "$.steps.order.shopify"
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
"id": "fulfil",
|
|
301
|
-
"use": "foreach",
|
|
302
|
-
"with": {
|
|
303
|
-
"over": "$.steps.fulfillmentOrders",
|
|
304
|
-
"max": 10
|
|
305
|
-
},
|
|
306
|
-
"do": [
|
|
307
|
-
{
|
|
308
|
-
"use": "shopify.fulfillment.create",
|
|
309
|
-
"when": "$.item.status == 'open' || $.item.status == 'in_progress'",
|
|
310
|
-
"with": {
|
|
311
|
-
"fulfillmentOrderId": "$.item.id",
|
|
312
|
-
"trackingInfo": {
|
|
313
|
-
"number": "$.record.package.packages[0].packageTrackingNumber",
|
|
314
|
-
"company": "$.settings.carrier"
|
|
315
|
-
},
|
|
316
|
-
"notifyCustomer": "$.settings.notifyCustomer"
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
]
|
|
320
|
-
}
|
|
321
|
-
]
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
"id": "low-stock-alert",
|
|
325
|
-
"label": "Low-stock alert in Slack",
|
|
326
|
-
"purpose": "notify",
|
|
327
|
-
"default": "off",
|
|
328
|
-
"settings": {
|
|
329
|
-
"threshold": {
|
|
330
|
-
"type": "number",
|
|
331
|
-
"label": "Alert when available stock falls to",
|
|
332
|
-
"default": 5
|
|
333
|
-
},
|
|
334
|
-
"channel": {
|
|
335
|
-
"type": "option",
|
|
336
|
-
"options": "slack.channel",
|
|
337
|
-
"label": "Post alerts to",
|
|
338
|
-
"required": true
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
"trigger": {
|
|
342
|
-
"type": "webhook",
|
|
343
|
-
"module": "shopify",
|
|
344
|
-
"topic": "inventory.updated",
|
|
345
|
-
"filter": "$.record.available <= $.settings.threshold"
|
|
346
|
-
},
|
|
347
|
-
"steps": [
|
|
348
|
-
{
|
|
349
|
-
"id": "variant",
|
|
350
|
-
"use": "shopify.variant.byInventoryItem",
|
|
351
|
-
"with": {
|
|
352
|
-
"inventoryItemId": "$.record.inventory_item_id"
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"id": "text",
|
|
357
|
-
"use": "template",
|
|
358
|
-
"with": {
|
|
359
|
-
"id": "low-stock"
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
"use": "slack.message.post",
|
|
364
|
-
"with": {
|
|
365
|
-
"channel": "$.settings.channel",
|
|
366
|
-
"text": "$.steps.text",
|
|
367
|
-
"unfurl_links": false
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
]
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"id": "refund-credit-memo",
|
|
374
|
-
"label": "Refunds become credit memos",
|
|
375
|
-
"description": "A Shopify refund creates a NetSuite credit memo against the original sales order, for the refunded lines only.",
|
|
376
|
-
"purpose": "write",
|
|
377
|
-
"default": "on",
|
|
378
|
-
"trigger": {
|
|
379
|
-
"type": "webhook",
|
|
380
|
-
"module": "shopify",
|
|
381
|
-
"topic": "refund.created"
|
|
382
|
-
},
|
|
383
|
-
"steps": [
|
|
384
|
-
{
|
|
385
|
-
"id": "order",
|
|
386
|
-
"use": "links.find",
|
|
387
|
-
"with": {
|
|
388
|
-
"sync": "orders",
|
|
389
|
-
"from": "shopify",
|
|
390
|
-
"id": "$.record.order_id"
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
"use": "stop",
|
|
395
|
-
"when": "$.steps.order == null",
|
|
396
|
-
"with": {
|
|
397
|
-
"reason": "Refunded order was never synced to NetSuite"
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
"id": "salesOrder",
|
|
402
|
-
"use": "netsuite.salesOrder.get",
|
|
403
|
-
"with": {
|
|
404
|
-
"id": "$.steps.order.netsuite"
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
"id": "lines",
|
|
409
|
-
"use": "code",
|
|
410
|
-
"with": {
|
|
411
|
-
"ref": "@acme/commerce-steps#netsuiteRefundLines@1.2.0",
|
|
412
|
-
"with": {
|
|
413
|
-
"refundLineItems": "$.record.refund_line_items",
|
|
414
|
-
"transactions": "$.record.transactions",
|
|
415
|
-
"salesOrderLines": "$.steps.salesOrder.item.items"
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
"id": "memo",
|
|
421
|
-
"use": "template",
|
|
422
|
-
"with": {
|
|
423
|
-
"id": "credit-memo"
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"use": "netsuite.creditMemo.create",
|
|
428
|
-
"with": {
|
|
429
|
-
"record": {
|
|
430
|
-
"externalId": "shopify-refund-{{record.id}}",
|
|
431
|
-
"entity": {
|
|
432
|
-
"id": "$.steps.salesOrder.entity.id"
|
|
433
|
-
},
|
|
434
|
-
"createdFrom": {
|
|
435
|
-
"id": "$.steps.order.netsuite"
|
|
436
|
-
},
|
|
437
|
-
"tranDate": "$.record.created_at",
|
|
438
|
-
"memo": "$.steps.memo",
|
|
439
|
-
"item": {
|
|
440
|
-
"items": "$.steps.lines.items"
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
]
|
|
446
|
-
}
|
|
447
|
-
],
|
|
448
|
-
"queries": [
|
|
449
|
-
{
|
|
450
|
-
"id": "netsuite-order",
|
|
451
|
-
"description": "The NetSuite sales order behind this Shopify order.",
|
|
452
|
-
"steps": [
|
|
453
|
-
{
|
|
454
|
-
"id": "order",
|
|
455
|
-
"use": "links.find",
|
|
456
|
-
"with": {
|
|
457
|
-
"sync": "orders",
|
|
458
|
-
"from": "shopify",
|
|
459
|
-
"id": "$.record.id"
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
"use": "stop",
|
|
464
|
-
"when": "$.steps.order == null",
|
|
465
|
-
"with": {
|
|
466
|
-
"reason": "Not synced"
|
|
467
|
-
}
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
"id": "salesOrder",
|
|
471
|
-
"use": "netsuite.salesOrder.get",
|
|
472
|
-
"with": {
|
|
473
|
-
"id": "$.steps.order.netsuite"
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
],
|
|
477
|
-
"returns": {
|
|
478
|
-
"salesOrder": "$.steps.salesOrder"
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
],
|
|
482
|
-
"ui": [
|
|
483
|
-
{
|
|
484
|
-
"id": "netsuite-status",
|
|
485
|
-
"label": "NetSuite",
|
|
486
|
-
"host": "shopify",
|
|
487
|
-
"placement": "admin.order-details.block",
|
|
488
|
-
"objects": [
|
|
489
|
-
"order"
|
|
490
|
-
],
|
|
491
|
-
"data": {
|
|
492
|
-
"query": "netsuite-order"
|
|
493
|
-
},
|
|
494
|
-
"view": {
|
|
495
|
-
"component": "Stack",
|
|
496
|
-
"children": [
|
|
497
|
-
{
|
|
498
|
-
"component": "Heading",
|
|
499
|
-
"props": {
|
|
500
|
-
"text": "NetSuite sales order"
|
|
501
|
-
}
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
"component": "Empty",
|
|
505
|
-
"when": "!($.data.salesOrder exists)",
|
|
506
|
-
"props": {
|
|
507
|
-
"text": "This order has not reached NetSuite yet. Only paid orders are synced."
|
|
508
|
-
}
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
"component": "KeyValue",
|
|
512
|
-
"when": "$.data.salesOrder exists",
|
|
513
|
-
"props": {
|
|
514
|
-
"items": [
|
|
515
|
-
{
|
|
516
|
-
"label": "Document",
|
|
517
|
-
"value": "{{data.salesOrder.tranId}}"
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
"label": "Status",
|
|
521
|
-
"value": "{{data.salesOrder.orderStatus}}"
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
"label": "Total",
|
|
525
|
-
"value": "{{data.salesOrder.total}} {{data.salesOrder.currency.refName}}"
|
|
526
|
-
}
|
|
527
|
-
]
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
]
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
],
|
|
534
|
-
"templates": {
|
|
535
|
-
"low-stock": ":warning: Low stock: *{{steps.variant.product_title}}* ({{steps.variant.sku}}) has {{record.available}} left at location {{record.location_id}}.",
|
|
536
|
-
"credit-memo": "Shopify refund {{record.id}} on order {{steps.salesOrder.otherRefNum}}. {{record.note | default: 'No reason given.'}}"
|
|
537
|
-
},
|
|
538
|
-
"lifecycle": {
|
|
539
|
-
"onInstall": [
|
|
540
|
-
{
|
|
541
|
-
"use": "shopify.webhook.create",
|
|
542
|
-
"with": {
|
|
543
|
-
"topic": "orders/create",
|
|
544
|
-
"address": "$.install.webhookUrls.shopify",
|
|
545
|
-
"format": "json"
|
|
546
|
-
},
|
|
547
|
-
"id": "hook-orders-create"
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
"use": "shopify.webhook.create",
|
|
551
|
-
"with": {
|
|
552
|
-
"topic": "orders/paid",
|
|
553
|
-
"address": "$.install.webhookUrls.shopify",
|
|
554
|
-
"format": "json"
|
|
555
|
-
},
|
|
556
|
-
"id": "hook-orders-paid"
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
"use": "shopify.webhook.create",
|
|
560
|
-
"with": {
|
|
561
|
-
"topic": "customers/create",
|
|
562
|
-
"address": "$.install.webhookUrls.shopify",
|
|
563
|
-
"format": "json"
|
|
564
|
-
},
|
|
565
|
-
"id": "hook-customers-create"
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
"use": "shopify.webhook.create",
|
|
569
|
-
"with": {
|
|
570
|
-
"topic": "customers/update",
|
|
571
|
-
"address": "$.install.webhookUrls.shopify",
|
|
572
|
-
"format": "json"
|
|
573
|
-
},
|
|
574
|
-
"id": "hook-customers-update"
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
"use": "shopify.webhook.create",
|
|
578
|
-
"with": {
|
|
579
|
-
"topic": "refunds/create",
|
|
580
|
-
"address": "$.install.webhookUrls.shopify",
|
|
581
|
-
"format": "json"
|
|
582
|
-
},
|
|
583
|
-
"id": "hook-refunds-create"
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
"use": "shopify.webhook.create",
|
|
587
|
-
"with": {
|
|
588
|
-
"topic": "inventory_levels/update",
|
|
589
|
-
"address": "$.install.webhookUrls.shopify",
|
|
590
|
-
"format": "json"
|
|
591
|
-
},
|
|
592
|
-
"id": "hook-inventory-levels-update"
|
|
593
|
-
}
|
|
594
|
-
],
|
|
595
|
-
"onUninstall": [
|
|
596
|
-
{
|
|
597
|
-
"id": "unhook",
|
|
598
|
-
"use": "foreach",
|
|
599
|
-
"with": {
|
|
600
|
-
"over": [
|
|
601
|
-
"$.install.runtime.installed.hook-orders-create.id",
|
|
602
|
-
"$.install.runtime.installed.hook-orders-paid.id",
|
|
603
|
-
"$.install.runtime.installed.hook-customers-create.id",
|
|
604
|
-
"$.install.runtime.installed.hook-customers-update.id",
|
|
605
|
-
"$.install.runtime.installed.hook-refunds-create.id",
|
|
606
|
-
"$.install.runtime.installed.hook-inventory-levels-update.id"
|
|
607
|
-
],
|
|
608
|
-
"max": 20
|
|
609
|
-
},
|
|
610
|
-
"do": [
|
|
611
|
-
{
|
|
612
|
-
"use": "shopify.webhook.delete",
|
|
613
|
-
"with": {
|
|
614
|
-
"id": "$.item"
|
|
615
|
-
},
|
|
616
|
-
"onError": "continue"
|
|
617
|
-
}
|
|
618
|
-
]
|
|
619
|
-
}
|
|
620
|
-
]
|
|
621
|
-
}
|
|
622
|
-
}
|