Skip to content

Commit

Permalink
Merge pull request #110 from Cloudshelf/CS-2081
Browse files Browse the repository at this point in the history
feat: support machine sizes for certain retailers
  • Loading branch information
ashleyww93 authored Jan 23, 2025
2 parents 13ce76d + fa47743 commit adc6bbb
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 128 deletions.
253 changes: 145 additions & 108 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"--- database options ---": "",
"db:generate:migration": "ENV_FILE_PATH=environment-variables/.local MIKRO_ORM_CLI_CONFIG=src/modules/database/mikro-orm.config.ts npx mikro-orm migration:create",
"db:migrate:down": "ENV_FILE_PATH=environment-variables/.local MIKRO_ORM_CLI_CONFIG=src/modules/database/mikro-orm.config.ts npx mikro-orm migration:down",
"db:migrate:up": "ENV_FILE_PATH=environment-variables/.local MIKRO_ORM_CLI_CONFIG=src/modules/database/mikro-orm.config.ts npx mikro-orm migration:up",
"db:migrate:up": "ENV_FILE_PATH=environment-variables/.dev MIKRO_ORM_CLI_CONFIG=src/modules/database/mikro-orm.config.ts npx mikro-orm migration:up",
"--- codegen options ---": "",
"codegen:cloudshelf": "graphql-codegen --config src/graphql/cloudshelf/codegen.ts",
"codegen:shopifyAdmin": "graphql-codegen --config src/graphql/shopifyAdmin/codegen.ts",
Expand Down Expand Up @@ -53,15 +53,20 @@
"@nestjs/platform-express": "^10.4.3",
"@nestjs/schedule": "^4.0.2",
"@nestjs/terminus": "^10.2.3",
"@opentelemetry/instrumentation-fs": "^0.14.0",
"@opentelemetry/instrumentation-http": "^0.52.1",
"@opentelemetry/instrumentation-pg": "^0.43.0",
"@opentelemetry/instrumentation-undici": "^0.4.0",
"@sentry/cli": "^2.25.3",
"@sentry/node": "^7.114.0",
"@sentry/profiling-node": "^1.3.5",
"@sentry/tracing": "^7.114.0",
"@shopify/shopify-api": "^9.0.2",
"@slack/web-api": "^7.0.1",
"@trigger.dev/sdk": "^3.3.7",
"@trigger.dev/sdk": "^3.3.11",
"apollo-server-core": "^3.13.0",
"async": "^3.2.5",
"class-transformer": "^0.3.1",
"date-fns": "^3.3.1",
"dotenv-flow": "^4.1.0",
"graphql": "^16.8.1",
Expand All @@ -72,15 +77,12 @@
"nestjs-cls": "^4.3.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.2.0",
"ulid": "^2.3.0",
"@opentelemetry/instrumentation-fs": "^0.14.0",
"@opentelemetry/instrumentation-http": "^0.52.1",
"@opentelemetry/instrumentation-pg": "^0.43.0",
"@opentelemetry/instrumentation-undici": "^0.4.0",
"class-transformer": "^0.3.1",
"ts-morph": "21.0.0"
"ts-morph": "*",
"ulid": "^2.3.0"
},
"devDependencies": {
"@azure/app-configuration": "1.7.0",
"@azure/keyvault-secrets": "4.8.0",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/introspection": "^4.0.0",
"@graphql-codegen/typescript": "4.0.1",
Expand All @@ -92,6 +94,7 @@
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.7",
"@shopify/cli": "^3.53.1",
"@trigger.dev/build": "^3.3.11",
"@types/async": "^3.2.24",
"@types/express": "^4.17.13",
"@types/jest": "29.5.0",
Expand All @@ -104,6 +107,10 @@
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "4.0.0",
"jest": "29.5.0",
"oci-common": "2.93.0",
"oci-identity": "2.93.0",
"oci-objectstorage": "2.93.0",
"oci-secrets": "2.93.0",
"patch-package": "^8.0.0",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
Expand All @@ -112,17 +119,11 @@
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.2.0",
"typescript": "^4.7.4",
"@azure/app-configuration": "1.7.0",
"@azure/keyvault-secrets": "4.8.0",
"oci-common": "2.93.0",
"oci-identity": "2.93.0",
"oci-secrets": "2.93.0",
"oci-objectstorage": "2.93.0",
"@trigger.dev/build": "^3.3.7"
"typescript": "^4.7.4"
},
"peerDependencies": {
"@apollo/subgraph": "*",
"@azure/app-configuration": "*",
"@nestjs/microservices": "*",
"@nestjs/platform-socket.io": "*",
"@nestjs/websockets": "*",
Expand All @@ -142,8 +143,7 @@
"pg-query-stream": "*",
"sqlite3": "*",
"tedious": "*",
"ts-morph": "*",
"@azure/app-configuration": "*"
"ts-morph": "*"
},
"peerDependenciesMeta": {
"@apollo/subgraph": {
Expand Down Expand Up @@ -236,4 +236,4 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
}
1 change: 1 addition & 0 deletions src/modules/data-ingestion/collection.job.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class CollectionJobUtils {
tags,
concurrencyKey: retailer.id,
idempotencyKey: await idempotencyKeys.create(bulkOp.shopifyBulkOpId),
machine: retailer.triggerMachineSizeProductGroups ?? undefined,
},
);
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/data-ingestion/product.job.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class ProductJobUtils {
tags,
concurrencyKey: retailer.id,
idempotencyKey: idempotencyKey,
machine: retailer.triggerMachineSizeProducts ?? undefined,
},
);

Expand Down
18 changes: 18 additions & 0 deletions src/modules/database/migrations/.snapshot-shopify-connector.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,24 @@
"primary": false,
"nullable": true,
"mappedType": "text"
},
"trigger_machine_size_products": {
"name": "trigger_machine_size_products",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"mappedType": "text"
},
"trigger_machine_size_product_groups": {
"name": "trigger_machine_size_product_groups",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"mappedType": "text"
}
},
"name": "retailer_entity",
Expand Down
13 changes: 13 additions & 0 deletions src/modules/database/migrations/Migration20250123151703.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Migration } from '@mikro-orm/migrations';

export class Migration20250123151703 extends Migration {

override async up(): Promise<void> {
this.addSql(`alter table "retailer_entity" add column "trigger_machine_size_products" text null, add column "trigger_machine_size_product_groups" text null;`);
}

override async down(): Promise<void> {
this.addSql(`alter table "retailer_entity" drop column "trigger_machine_size_products", drop column "trigger_machine_size_product_groups";`);
}

}
7 changes: 7 additions & 0 deletions src/modules/retailer/retailer.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Entity, Index, Property, types } from '@mikro-orm/core';
import { MachineSize } from '../../trigger/reuseables/machines_size';
import { BaseEntity } from '../database/abstract-entities/entity.base';

@Entity({ tableName: 'retailer_entity' })
Expand Down Expand Up @@ -55,6 +56,12 @@ export class RetailerEntity extends BaseEntity {
@Property({ type: 'text', nullable: true })
syncErrorCode: string | null;

@Property({ type: 'text', nullable: true })
triggerMachineSizeProducts: MachineSize | null;

@Property({ type: 'text', nullable: true })
triggerMachineSizeProductGroups: MachineSize | null;

async supportsWithPublicationStatus(): Promise<boolean> {
return this.scopes.includes('read_product_listings');
}
Expand Down
1 change: 1 addition & 0 deletions src/trigger/reuseables/machines_size.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type MachineSize = 'micro' | 'small-1x' | 'small-2x' | 'medium-1x' | 'medium-2x' | 'large-1x' | 'large-2x';
1 change: 1 addition & 0 deletions trigger.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { defineConfig, logger, usage } from '@trigger.dev/sdk/v3';

export default defineConfig({
project: 'proj_pnqbfgxmeuaytlevhxap',
maxDuration: 7200, // 2 hours
build: {
external: [
'@as-integrations/fastify',
Expand Down

0 comments on commit adc6bbb

Please sign in to comment.