-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from gadget-inc/nonem-shopify-ts
non-embedded Shopify app TS
- Loading branch information
Showing
69 changed files
with
860 additions
and
885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.gadget/ | ||
node_modules/ | ||
**/.DS_Store | ||
**/.DS_Store | ||
|
||
# Shopify | ||
extensions/**/dist | ||
extensions/**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Shopify | ||
extensions/**/dist | ||
extensions/**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
shopify/standalone-shopify-template/api/models/shopPermission/actions/create.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
shopify/standalone-shopify-template/api/models/shopPermission/actions/create.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { applyParams, save, ActionOptions } from "gadget-server"; | ||
|
||
export const run: ActionRun = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
applyParams(params, record); | ||
await save(record); | ||
}; | ||
|
||
export const options: ActionOptions = { | ||
actionType: "create", | ||
}; |
20 changes: 0 additions & 20 deletions
20
shopify/standalone-shopify-template/api/models/shopPermission/actions/delete.js
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
shopify/standalone-shopify-template/api/models/shopPermission/actions/delete.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { deleteRecord, ActionOptions } from "gadget-server"; | ||
|
||
export const run: ActionRun = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
await deleteRecord(record); | ||
}; | ||
|
||
export const options: ActionOptions = { | ||
actionType: "delete", | ||
}; |
21 changes: 0 additions & 21 deletions
21
shopify/standalone-shopify-template/api/models/shopPermission/actions/update.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
shopify/standalone-shopify-template/api/models/shopPermission/actions/update.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { applyParams, save, ActionOptions } from "gadget-server"; | ||
|
||
export const run: ActionRun = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
applyParams(params, record); | ||
await save(record); | ||
}; | ||
|
||
export const options: ActionOptions = { | ||
actionType: "update", | ||
}; |
43 changes: 28 additions & 15 deletions
43
...dels/shopifyGdprRequest/actions/create.js → ...dels/shopifyGdprRequest/actions/create.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,47 @@ | ||
import { applyParams, preventCrossShopDataAccess, save, ActionOptions, CreateShopifyGdprRequestActionContext } from "gadget-server"; | ||
import { | ||
applyParams, | ||
preventCrossShopDataAccess, | ||
save, | ||
ActionOptions, | ||
} from "gadget-server"; | ||
|
||
/** | ||
* @param { CreateShopifyGdprRequestActionContext } context | ||
*/ | ||
export async function run({ params, record, logger, api, connections }) { | ||
export const run: ActionRun = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
applyParams(params, record); | ||
await preventCrossShopDataAccess(params, record); | ||
await save(record); | ||
}; | ||
|
||
/** | ||
* @param { CreateShopifyGdprRequestActionContext } context | ||
*/ | ||
export async function onSuccess({ params, record, logger, api, connections }) { | ||
switch(record.topic) { | ||
case "customers/data_request": | ||
export const onSuccess: ActionOnSuccess = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
switch (record.topic) { | ||
case "customers/data_request": { | ||
// This process is a manual one. You must provide the customer's data to the store owners directly. | ||
// See https://shopify.dev/apps/webhooks/configuration/mandatory-webhooks#customers-data_request for more information. | ||
break; | ||
case "customers/redact": | ||
} | ||
case "customers/redact": { | ||
// Any modifications that are initiated by Shopify and emitted via webhook will automatically be handled by your existing model actions. | ||
// The responsibility falls on you to redact any additional customer related data you may have in custom models. | ||
break; | ||
case "shop/redact": | ||
} | ||
case "shop/redact": { | ||
// This will be received 48 hours after a store owner uninstalls your app. Any modifications that are initiated by Shopify and emitted via webhook will automatically be handled by your existing model actions. | ||
// The responsibility falls on you to redact any additional shop related data you may have in custom models. | ||
// See https://shopify.dev/apps/webhooks/configuration/mandatory-webhooks#shop-redact for more information. | ||
break; | ||
} | ||
} | ||
}; | ||
|
||
/** @type { ActionOptions } */ | ||
export const options = { actionType: "create" }; | ||
export const options: ActionOptions = { actionType: "create" }; |
20 changes: 0 additions & 20 deletions
20
shopify/standalone-shopify-template/api/models/shopifyGdprRequest/actions/update.js
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
shopify/standalone-shopify-template/api/models/shopifyGdprRequest/actions/update.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
applyParams, | ||
preventCrossShopDataAccess, | ||
save, | ||
ActionOptions, | ||
} from "gadget-server"; | ||
|
||
export const run: ActionRun = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
applyParams(params, record); | ||
await preventCrossShopDataAccess(params, record); | ||
await save(record); | ||
}; | ||
|
||
export const onSuccess: ActionOnSuccess = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
// Your logic goes here | ||
}; | ||
|
||
export const options: ActionOptions = { actionType: "update" }; |
19 changes: 0 additions & 19 deletions
19
shopify/standalone-shopify-template/api/models/shopifyShop/actions/install.js
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
shopify/standalone-shopify-template/api/models/shopifyShop/actions/install.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { applyParams, save, ActionOptions } from "gadget-server"; | ||
|
||
export const run: ActionRun = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
applyParams(params, record); | ||
await save(record); | ||
}; | ||
|
||
export const onSuccess: ActionOnSuccess = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
// Your logic goes here | ||
}; | ||
|
||
export const options: ActionOptions = { actionType: "create" }; |
20 changes: 0 additions & 20 deletions
20
shopify/standalone-shopify-template/api/models/shopifyShop/actions/reinstall.js
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
shopify/standalone-shopify-template/api/models/shopifyShop/actions/reinstall.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
applyParams, | ||
preventCrossShopDataAccess, | ||
save, | ||
ActionOptions, | ||
} from "gadget-server"; | ||
|
||
export const run: ActionRun = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
applyParams(params, record); | ||
await preventCrossShopDataAccess(params, record); | ||
await save(record); | ||
}; | ||
|
||
export const onSuccess: ActionOnSuccess = async ({ | ||
params, | ||
record, | ||
logger, | ||
api, | ||
connections, | ||
}) => { | ||
// Your logic goes here | ||
}; | ||
|
||
export const options: ActionOptions = { actionType: "update" }; |
20 changes: 0 additions & 20 deletions
20
shopify/standalone-shopify-template/api/models/shopifyShop/actions/uninstall.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.