Skip to content

Commit 5e6300c

Browse files
committed
feat(server): add component loads limit to stripe plans and update related models
1 parent 07e2778 commit 5e6300c

9 files changed

Lines changed: 65 additions & 15 deletions

File tree

clients/trieve-shopify-extension/app/queries/onboarding.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ query GetStoreThemes {
9595
}
9696
`,
9797
);
98-
console.log("THEME LIST", result);
9998
if (result.error) {
10099
console.error(result.error);
101100
throw result.error;

clients/trieve-shopify-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"react-dom": "^18.2.0",
5353
"tailwind-merge": "^3.1.0",
5454
"tailwindcss": "^3.4.17",
55-
"trieve-ts-sdk": "0.0.80",
55+
"trieve-ts-sdk": "0.0.81",
5656
"vite-tsconfig-paths": "^5.0.1",
5757
"trieve-search-component": "0.4.55"
5858
},

clients/trieve-shopify-extension/shopify.app.toml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ api_version = "2025-01"
2929
topics = [ "products/delete" ]
3030
uri = "/webhooks/app/products/delete"
3131

32+
[[webhooks.subscriptions]]
33+
topics = [ "app_subscriptions/update" ]
34+
uri = "/webhooks/app/app_subscriptions/update"
35+
3236
[access_scopes]
3337
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
3438
scopes = "write_products,read_products,read_themes"

clients/trieve-shopify-extension/yarn.lock

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8964,8 +8964,16 @@ string-hash@^1.1.3:
89648964
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"
89658965
integrity sha512-kJUvRUFK49aub+a7T1nNE66EJbZBMnBgoC1UbCZ5n6bsZKBRga4KgBRTMn/pFkeCZSYtNeSyMxPDM0AXWELk2A==
89668966

8967-
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
8968-
name string-width-cjs
8967+
"string-width-cjs@npm:string-width@^4.2.0":
8968+
version "4.2.3"
8969+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
8970+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
8971+
dependencies:
8972+
emoji-regex "^8.0.0"
8973+
is-fullwidth-code-point "^3.0.0"
8974+
strip-ansi "^6.0.1"
8975+
8976+
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
89698977
version "4.2.3"
89708978
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
89718979
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -9073,7 +9081,14 @@ stringify-entities@^4.0.0:
90739081
character-entities-html4 "^2.0.0"
90749082
character-entities-legacy "^3.0.0"
90759083

9076-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
9084+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
9085+
version "6.0.1"
9086+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
9087+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
9088+
dependencies:
9089+
ansi-regex "^5.0.1"
9090+
9091+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
90779092
version "6.0.1"
90789093
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
90799094
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -9342,10 +9357,10 @@ trieve-ts-sdk@0.0.73:
93429357
resolved "https://registry.yarnpkg.com/trieve-ts-sdk/-/trieve-ts-sdk-0.0.73.tgz#9de17428ddb4b1f6d68709695f371d185c4bda79"
93439358
integrity sha512-68iG/OlmKSGmnmI/J33S6VKleEAfq4txzARhvKv1g+CYSaG7HOH76n0cFDMtUUEEKn1PD4nV82uh5ZFtfIxD0A==
93449359

9345-
trieve-ts-sdk@0.0.80:
9346-
version "0.0.80"
9347-
resolved "https://registry.yarnpkg.com/trieve-ts-sdk/-/trieve-ts-sdk-0.0.80.tgz#f42eb9cdc6f9f47acfc6f0e3f68a84dfd7bc0452"
9348-
integrity sha512-BzjOKAvRwvTvvc6q/SmFkPxm9XSJO/mzJ8G0RvZ/I2NoHKwqu7O3Kd2620sT+46FFvQi2/cOfOzHepd6qKfyvA==
9360+
trieve-ts-sdk@0.0.81:
9361+
version "0.0.81"
9362+
resolved "https://registry.yarnpkg.com/trieve-ts-sdk/-/trieve-ts-sdk-0.0.81.tgz#85313acd01aff48798d5a37e0ba8a5d0bf6592e3"
9363+
integrity sha512-HLUH6xCeH3OTPGRN5cMnhV6NPAI46y/eJ386sIkq9HuuSQA2HwQi2NpA3Bp6wabo4QdlxwzVzzJLawec8aUwXQ==
93499364

93509365
trim-lines@^3.0.0:
93519366
version "3.0.1"
@@ -10005,8 +10020,7 @@ word-wrap@^1.2.5:
1000510020
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
1000610021
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
1000710022

10008-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
10009-
name wrap-ansi-cjs
10023+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
1001010024
version "7.0.0"
1001110025
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1001210026
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -10024,6 +10038,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
1002410038
string-width "^4.1.0"
1002510039
strip-ansi "^6.0.0"
1002610040

10041+
wrap-ansi@^7.0.0:
10042+
version "7.0.0"
10043+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
10044+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
10045+
dependencies:
10046+
ansi-styles "^4.0.0"
10047+
string-width "^4.1.0"
10048+
strip-ansi "^6.0.0"
10049+
1002710050
wrap-ansi@^8.1.0:
1002810051
version "8.1.0"
1002910052
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- This file should undo anything in `up.sql`
2+
ALTER TABLE stripe_plans DROP COLUMN component_loads;
3+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Your SQL goes here
2+
ALTER TABLE stripe_plans ADD COLUMN component_loads INTEGER NULL;

server/src/data/models.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,6 +3837,7 @@ impl Invitation {
38373837
"created_at": "2021-01-01 00:00:00.000",
38383838
"updated_at": "2021-01-01 00:00:00.000",
38393839
"name": "Free",
3840+
"component_loads": 1000,
38403841
}))]
38413842
#[diesel(table_name = stripe_plans)]
38423843
pub struct StripePlan {
@@ -3852,6 +3853,7 @@ pub struct StripePlan {
38523853
pub name: String,
38533854
pub visible: bool,
38543855
pub file_storage: i64,
3856+
pub component_loads: Option<i32>,
38553857
}
38563858

38573859
impl StripePlan {
@@ -3866,6 +3868,7 @@ impl StripePlan {
38663868
amount: i64,
38673869
name: String,
38683870
visible: bool,
3871+
component_loads: Option<i32>,
38693872
) -> Self {
38703873
StripePlan {
38713874
id: uuid::Uuid::new_v4(),
@@ -3880,6 +3883,7 @@ impl StripePlan {
38803883
updated_at: chrono::Utc::now().naive_local(),
38813884
name,
38823885
visible,
3886+
component_loads,
38833887
}
38843888
}
38853889
}
@@ -3901,6 +3905,7 @@ impl Default for StripePlan {
39013905
updated_at: chrono::Utc::now().naive_local(),
39023906
name: "Unlimited".to_string(),
39033907
visible: true,
3908+
component_loads: Some(i32::MAX),
39043909
};
39053910
}
39063911

@@ -3917,6 +3922,7 @@ impl Default for StripePlan {
39173922
updated_at: chrono::Utc::now().naive_local(),
39183923
name: "Free".to_string(),
39193924
visible: true,
3925+
component_loads: Some(1000),
39203926
}
39213927
}
39223928
}

server/src/data/schema.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ diesel::table! {
242242
name -> Text,
243243
visible -> Bool,
244244
file_storage -> Int8,
245+
component_loads -> Nullable<Int4>,
245246
}
246247
}
247248

server/src/operators/dittofeed_operator.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,15 @@ pub async fn send_user_ditto_identity(
312312
.json(&batch_request)
313313
.send()
314314
.await
315-
.map_err(|e| ServiceError::BadRequest(e.to_string()))?
315+
.map_err(|e| {
316+
log::error!("Error sending request to Dittofeed for /apps/batch: {}", e);
317+
ServiceError::BadRequest(e.to_string())
318+
})?
316319
.error_for_status()
317-
.map_err(|e| ServiceError::BadRequest(e.to_string()))?;
320+
.map_err(|e| {
321+
log::error!("Error sending request to Dittofeed /apps/batch: {}", e);
322+
ServiceError::BadRequest(e.to_string())
323+
})?;
318324

319325
Ok(())
320326
}
@@ -339,9 +345,15 @@ pub async fn send_ditto_event(event: DittoTrackRequest) -> Result<(), ServiceErr
339345
.json(&event)
340346
.send()
341347
.await
342-
.map_err(|e| ServiceError::BadRequest(e.to_string()))?
348+
.map_err(|e| {
349+
log::error!("Error sending request to Dittofeed for /apps/track: {}", e);
350+
ServiceError::BadRequest(e.to_string())
351+
})?
343352
.error_for_status()
344-
.map_err(|e| ServiceError::BadRequest(e.to_string()))?;
353+
.map_err(|e| {
354+
log::error!("Error sending request to Dittofeed for /apps/track: {}", e);
355+
ServiceError::BadRequest(e.to_string())
356+
})?;
345357

346358
Ok(())
347359
}

0 commit comments

Comments
 (0)