@amohamud23/notihub 1.1.42 → 1.1.43
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/dist/index.cjs +25 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1853,6 +1853,31 @@ var StripeSubscription = class _StripeSubscription {
|
|
|
1853
1853
|
throw new Error("Could not fetch stripe subscriptions by customerId");
|
|
1854
1854
|
}
|
|
1855
1855
|
}
|
|
1856
|
+
static async getStripeSubscriptionsByStripeCustomerId(stripeCustomerId) {
|
|
1857
|
+
const command = new import_lib_dynamodb15.QueryCommand({
|
|
1858
|
+
TableName: _StripeSubscription.TABLE_NAME,
|
|
1859
|
+
IndexName: "StripeCustomerIdIndex",
|
|
1860
|
+
KeyConditionExpression: "stripe_customerId = :stripeCustomerId",
|
|
1861
|
+
ExpressionAttributeValues: {
|
|
1862
|
+
":stripeCustomerId": stripeCustomerId
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
try {
|
|
1866
|
+
const result = await ddbDocClient.send(command);
|
|
1867
|
+
if (!result.Items || result.Items.length === 0) {
|
|
1868
|
+
return null;
|
|
1869
|
+
}
|
|
1870
|
+
return result.Items[0];
|
|
1871
|
+
} catch (error) {
|
|
1872
|
+
console.error(
|
|
1873
|
+
"Error fetching stripe subscriptions by stripe customerId:",
|
|
1874
|
+
error
|
|
1875
|
+
);
|
|
1876
|
+
throw new Error(
|
|
1877
|
+
"Could not fetch stripe subscriptions by stripe customerId"
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1856
1881
|
/**
|
|
1857
1882
|
* Creates a new stripe subscription.
|
|
1858
1883
|
* @param stripeSubscription - The stripe subscription object to create.
|
package/dist/index.d.cts
CHANGED
|
@@ -733,6 +733,7 @@ declare class StripeSubscription {
|
|
|
733
733
|
* @returns A promise that resolves to an array of stripe subscription objects.
|
|
734
734
|
*/
|
|
735
735
|
static getStripeSubscriptionsByCustomerId(customerId: string): Promise<INotiHubStripeSubscription[]>;
|
|
736
|
+
static getStripeSubscriptionsByStripeCustomerId(stripeCustomerId: string): Promise<INotiHubStripeSubscription | null>;
|
|
736
737
|
/**
|
|
737
738
|
* Creates a new stripe subscription.
|
|
738
739
|
* @param stripeSubscription - The stripe subscription object to create.
|
package/dist/index.d.ts
CHANGED
|
@@ -733,6 +733,7 @@ declare class StripeSubscription {
|
|
|
733
733
|
* @returns A promise that resolves to an array of stripe subscription objects.
|
|
734
734
|
*/
|
|
735
735
|
static getStripeSubscriptionsByCustomerId(customerId: string): Promise<INotiHubStripeSubscription[]>;
|
|
736
|
+
static getStripeSubscriptionsByStripeCustomerId(stripeCustomerId: string): Promise<INotiHubStripeSubscription | null>;
|
|
736
737
|
/**
|
|
737
738
|
* Creates a new stripe subscription.
|
|
738
739
|
* @param stripeSubscription - The stripe subscription object to create.
|
package/dist/index.js
CHANGED
|
@@ -1883,6 +1883,31 @@ var StripeSubscription = class _StripeSubscription {
|
|
|
1883
1883
|
throw new Error("Could not fetch stripe subscriptions by customerId");
|
|
1884
1884
|
}
|
|
1885
1885
|
}
|
|
1886
|
+
static async getStripeSubscriptionsByStripeCustomerId(stripeCustomerId) {
|
|
1887
|
+
const command = new QueryCommand13({
|
|
1888
|
+
TableName: _StripeSubscription.TABLE_NAME,
|
|
1889
|
+
IndexName: "StripeCustomerIdIndex",
|
|
1890
|
+
KeyConditionExpression: "stripe_customerId = :stripeCustomerId",
|
|
1891
|
+
ExpressionAttributeValues: {
|
|
1892
|
+
":stripeCustomerId": stripeCustomerId
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
try {
|
|
1896
|
+
const result = await ddbDocClient.send(command);
|
|
1897
|
+
if (!result.Items || result.Items.length === 0) {
|
|
1898
|
+
return null;
|
|
1899
|
+
}
|
|
1900
|
+
return result.Items[0];
|
|
1901
|
+
} catch (error) {
|
|
1902
|
+
console.error(
|
|
1903
|
+
"Error fetching stripe subscriptions by stripe customerId:",
|
|
1904
|
+
error
|
|
1905
|
+
);
|
|
1906
|
+
throw new Error(
|
|
1907
|
+
"Could not fetch stripe subscriptions by stripe customerId"
|
|
1908
|
+
);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1886
1911
|
/**
|
|
1887
1912
|
* Creates a new stripe subscription.
|
|
1888
1913
|
* @param stripeSubscription - The stripe subscription object to create.
|