@adtrackify/at-service-common 1.0.73 → 1.0.75
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/.editorconfig +12 -12
- package/.vscode/settings.json +9 -9
- package/bitbucket-pipelines.yml +20 -20
- package/build.js +21 -21
- package/dist/index.d.ts +9 -4
- package/dist/index.js +10 -1
- package/dist/index.js.map +2 -2
- package/jest.config.ts +40 -40
- package/package.json +1 -1
- package/src/__tests__/helpers/subscription-helper.spec.ts +40 -40
- package/src/clients/generic/axios.d.ts +7 -7
- package/src/clients/generic/dynamodb-client.ts +113 -113
- package/src/clients/generic/eventbridge-client.ts +52 -52
- package/src/clients/internal-api/destinations-client.ts +58 -58
- package/src/clients/internal-api/index.ts +4 -4
- package/src/clients/internal-api/shopify-app-install-client.ts +59 -59
- package/src/clients/internal-api/users-auth-client.ts +111 -111
- package/src/clients/third-party/shopify-client.ts +12 -1
- package/src/helpers/index.ts +5 -5
- package/src/helpers/input-validation-helper.ts +21 -21
- package/src/helpers/shopify-helper.ts +39 -39
- package/src/helpers/subscription-helper.ts +234 -234
- package/src/index.ts +4 -4
- package/src/libs/index.ts +7 -7
- package/src/libs/url.ts +9 -9
- package/src/services/eventbridge-integration-service.ts +44 -44
- package/src/types/internal-events/event-detail-types.ts +9 -9
- package/tsconfig.json +35 -35
package/.editorconfig
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
end_of_line = lf
|
|
5
|
-
charset = utf-8
|
|
6
|
-
trim_trailing_whitespace = true
|
|
7
|
-
insert_final_newline = false
|
|
8
|
-
indent_style = space
|
|
9
|
-
indent_size = 2
|
|
10
|
-
|
|
11
|
-
[*.{diff,md}]
|
|
12
|
-
trim_trailing_whitespace = false
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
end_of_line = lf
|
|
5
|
+
charset = utf-8
|
|
6
|
+
trim_trailing_whitespace = true
|
|
7
|
+
insert_final_newline = false
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
|
|
11
|
+
[*.{diff,md}]
|
|
12
|
+
trim_trailing_whitespace = false
|
package/.vscode/settings.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{ "eslint.validate": [
|
|
2
|
-
"javascript",
|
|
3
|
-
"javascriptreact",
|
|
4
|
-
"typescript",
|
|
5
|
-
"typescriptreact"
|
|
6
|
-
],
|
|
7
|
-
"editor.codeActionsOnSave": {
|
|
8
|
-
"source.fixAll.eslint": true,
|
|
9
|
-
},
|
|
1
|
+
{ "eslint.validate": [
|
|
2
|
+
"javascript",
|
|
3
|
+
"javascriptreact",
|
|
4
|
+
"typescript",
|
|
5
|
+
"typescriptreact"
|
|
6
|
+
],
|
|
7
|
+
"editor.codeActionsOnSave": {
|
|
8
|
+
"source.fixAll.eslint": true,
|
|
9
|
+
},
|
|
10
10
|
}
|
package/bitbucket-pipelines.yml
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
image: node:16.18.0
|
|
2
|
-
|
|
3
|
-
pipelines:
|
|
4
|
-
default:
|
|
5
|
-
- step:
|
|
6
|
-
caches:
|
|
7
|
-
- node
|
|
8
|
-
script:
|
|
9
|
-
- printf "//`node -p \"require('url').parse(process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\nregistry=${NPM_REGISTRY_URL:-https://registry.npmjs.org}\n" >> ~/.npmrc
|
|
10
|
-
- npm install
|
|
11
|
-
- npm run build:dev
|
|
12
|
-
branches:
|
|
13
|
-
master:
|
|
14
|
-
- step:
|
|
15
|
-
deployment: prod
|
|
16
|
-
caches:
|
|
17
|
-
- node
|
|
18
|
-
script:
|
|
19
|
-
- printf "//`node -p \"require('url').parse(process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\nregistry=${NPM_REGISTRY_URL:-https://registry.npmjs.org}\n" >> ~/.npmrc
|
|
20
|
-
- npm run push
|
|
1
|
+
image: node:16.18.0
|
|
2
|
+
|
|
3
|
+
pipelines:
|
|
4
|
+
default:
|
|
5
|
+
- step:
|
|
6
|
+
caches:
|
|
7
|
+
- node
|
|
8
|
+
script:
|
|
9
|
+
- printf "//`node -p \"require('url').parse(process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\nregistry=${NPM_REGISTRY_URL:-https://registry.npmjs.org}\n" >> ~/.npmrc
|
|
10
|
+
- npm install
|
|
11
|
+
- npm run build:dev
|
|
12
|
+
branches:
|
|
13
|
+
master:
|
|
14
|
+
- step:
|
|
15
|
+
deployment: prod
|
|
16
|
+
caches:
|
|
17
|
+
- node
|
|
18
|
+
script:
|
|
19
|
+
- printf "//`node -p \"require('url').parse(process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\nregistry=${NPM_REGISTRY_URL:-https://registry.npmjs.org}\n" >> ~/.npmrc
|
|
20
|
+
- npm run push
|
package/build.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
const { build } = require('esbuild')
|
|
6
|
-
const { dependencies } = require('./package.json')
|
|
7
|
-
const { Generator } = require('npm-dts')
|
|
8
|
-
|
|
9
|
-
new Generator({
|
|
10
|
-
entry: 'src/index.ts',
|
|
11
|
-
output: 'dist/index.d.ts',
|
|
12
|
-
}).generate()
|
|
13
|
-
|
|
14
|
-
build({
|
|
15
|
-
entryPoints: ['./src/index.ts'],
|
|
16
|
-
outdir: 'dist',
|
|
17
|
-
bundle: true,
|
|
18
|
-
format: 'esm',
|
|
19
|
-
platform: 'node',
|
|
20
|
-
sourcemap: 'linked',
|
|
21
|
-
external: [...Object.keys(dependencies), 'aws-sdk', "@faker-js/faker"]
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
const { build } = require('esbuild')
|
|
6
|
+
const { dependencies } = require('./package.json')
|
|
7
|
+
const { Generator } = require('npm-dts')
|
|
8
|
+
|
|
9
|
+
new Generator({
|
|
10
|
+
entry: 'src/index.ts',
|
|
11
|
+
output: 'dist/index.d.ts',
|
|
12
|
+
}).generate()
|
|
13
|
+
|
|
14
|
+
build({
|
|
15
|
+
entryPoints: ['./src/index.ts'],
|
|
16
|
+
outdir: 'dist',
|
|
17
|
+
bundle: true,
|
|
18
|
+
format: 'esm',
|
|
19
|
+
platform: 'node',
|
|
20
|
+
sourcemap: 'linked',
|
|
21
|
+
external: [...Object.keys(dependencies), 'aws-sdk', "@faker-js/faker"]
|
|
22
22
|
})
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
declare module '@adtrackify/at-service-common/__tests__/helpers/subscription-helper.spec' {
|
|
2
|
-
export {};
|
|
3
|
-
|
|
4
|
-
}
|
|
5
1
|
declare module '@adtrackify/at-service-common/clients/generic/dynamodb-client' {
|
|
6
2
|
import AWS from 'aws-sdk';
|
|
7
3
|
export class DynamoDbClient {
|
|
@@ -419,6 +415,11 @@ declare module '@adtrackify/at-service-common/clients/third-party/shopify-client
|
|
|
419
415
|
data: any;
|
|
420
416
|
status: any;
|
|
421
417
|
}>;
|
|
418
|
+
static cancelAppSubscription: (shop: string, accessToken: string, chargeId: string) => Promise<{
|
|
419
|
+
headers: any;
|
|
420
|
+
data: any;
|
|
421
|
+
status: any;
|
|
422
|
+
}>;
|
|
422
423
|
static listAppSubscriptions: (shop: string, accessToken: string) => Promise<{
|
|
423
424
|
headers: any;
|
|
424
425
|
data: any;
|
|
@@ -687,6 +688,10 @@ declare module '@adtrackify/at-service-common/types/internal-events/event-detail
|
|
|
687
688
|
declare module '@adtrackify/at-service-common/types/internal-events/index' {
|
|
688
689
|
export * from '@adtrackify/at-service-common/types/internal-events/event-detail-types';
|
|
689
690
|
|
|
691
|
+
}
|
|
692
|
+
declare module '@adtrackify/at-service-common/__tests__/helpers/subscription-helper.spec' {
|
|
693
|
+
export {};
|
|
694
|
+
|
|
690
695
|
}
|
|
691
696
|
declare module '@adtrackify/at-service-common' {
|
|
692
697
|
import main = require('@adtrackify/at-service-common/src/index');
|
package/dist/index.js
CHANGED
|
@@ -677,7 +677,7 @@ __publicField(ShopifyClient, "updateShopifyAppMetafield", async (shop, accessTok
|
|
|
677
677
|
};
|
|
678
678
|
const res = await _ShopifyClient.genericShopifyPost(url, accessToken, payload);
|
|
679
679
|
if (res.status >= 400) {
|
|
680
|
-
log8.error("Failed to
|
|
680
|
+
log8.error("Failed to update Shopify app Metafield ", { shop, accessToken, url, payload });
|
|
681
681
|
}
|
|
682
682
|
return res;
|
|
683
683
|
});
|
|
@@ -704,6 +704,15 @@ __publicField(ShopifyClient, "createAppSubscription", async (shop, accessToken,
|
|
|
704
704
|
}
|
|
705
705
|
return res;
|
|
706
706
|
});
|
|
707
|
+
__publicField(ShopifyClient, "cancelAppSubscription", async (shop, accessToken, chargeId) => {
|
|
708
|
+
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges/${chargeId}.json`;
|
|
709
|
+
const client2 = axiosHttpService();
|
|
710
|
+
const res = await client2.delete(url, { headers: { "X-Shopify-Access-Token": accessToken } });
|
|
711
|
+
if (res.status !== 200) {
|
|
712
|
+
log8.error("Failed to cancel recurring App billing", { shop, accessToken, url });
|
|
713
|
+
}
|
|
714
|
+
return res;
|
|
715
|
+
});
|
|
707
716
|
__publicField(ShopifyClient, "listAppSubscriptions", async (shop, accessToken) => {
|
|
708
717
|
const url = `https://${shop}/admin/api/${_ShopifyClient._shopify_api_version}/recurring_application_charges.json`;
|
|
709
718
|
const res = await _ShopifyClient.genericShopifyGet(url, accessToken);
|