@moneymq/better-auth 0.5.0 → 0.9.0
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.d.mts +20 -15
- package/dist/index.d.ts +20 -15
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -27,9 +27,9 @@ interface UsageMetric {
|
|
|
27
27
|
*/
|
|
28
28
|
name: string;
|
|
29
29
|
/**
|
|
30
|
-
* MoneyMQ
|
|
30
|
+
* MoneyMQ product ID for this metric
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
productId: string;
|
|
33
33
|
/**
|
|
34
34
|
* Human-readable display name
|
|
35
35
|
*/
|
|
@@ -254,8 +254,8 @@ interface CreateCheckoutParams {
|
|
|
254
254
|
* usage: {
|
|
255
255
|
* enabled: true,
|
|
256
256
|
* metrics: [
|
|
257
|
-
* { name: 'api_calls',
|
|
258
|
-
* { name: 'storage',
|
|
257
|
+
* { name: 'api_calls', productId: 'api-calls-metered', unit: 'requests' },
|
|
258
|
+
* { name: 'storage', productId: 'storage-metered', unit: 'GB' },
|
|
259
259
|
* ],
|
|
260
260
|
* },
|
|
261
261
|
* }),
|
|
@@ -340,7 +340,7 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
|
|
|
340
340
|
url: string;
|
|
341
341
|
sessionId: string;
|
|
342
342
|
lineItems: {
|
|
343
|
-
|
|
343
|
+
productId: string;
|
|
344
344
|
quantity: number;
|
|
345
345
|
}[];
|
|
346
346
|
totalRecords: number;
|
|
@@ -349,14 +349,17 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
|
|
|
349
349
|
method: "POST";
|
|
350
350
|
body: z.ZodObject<{
|
|
351
351
|
lineItems: z.ZodArray<z.ZodObject<{
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
productId: z.ZodString;
|
|
353
|
+
experimentId: z.ZodOptional<z.ZodString>;
|
|
354
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
354
355
|
}, "strip", z.ZodTypeAny, {
|
|
355
|
-
|
|
356
|
-
|
|
356
|
+
productId: string;
|
|
357
|
+
quantity?: number | undefined;
|
|
358
|
+
experimentId?: string | undefined;
|
|
357
359
|
}, {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
productId: string;
|
|
361
|
+
quantity?: number | undefined;
|
|
362
|
+
experimentId?: string | undefined;
|
|
360
363
|
}>, "many">;
|
|
361
364
|
successUrl: z.ZodString;
|
|
362
365
|
cancelUrl: z.ZodString;
|
|
@@ -365,16 +368,18 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
|
|
|
365
368
|
successUrl: string;
|
|
366
369
|
cancelUrl: string;
|
|
367
370
|
lineItems: {
|
|
368
|
-
|
|
369
|
-
|
|
371
|
+
productId: string;
|
|
372
|
+
quantity?: number | undefined;
|
|
373
|
+
experimentId?: string | undefined;
|
|
370
374
|
}[];
|
|
371
375
|
metadata?: Record<string, string> | undefined;
|
|
372
376
|
}, {
|
|
373
377
|
successUrl: string;
|
|
374
378
|
cancelUrl: string;
|
|
375
379
|
lineItems: {
|
|
376
|
-
|
|
377
|
-
|
|
380
|
+
productId: string;
|
|
381
|
+
quantity?: number | undefined;
|
|
382
|
+
experimentId?: string | undefined;
|
|
378
383
|
}[];
|
|
379
384
|
metadata?: Record<string, string> | undefined;
|
|
380
385
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,9 +27,9 @@ interface UsageMetric {
|
|
|
27
27
|
*/
|
|
28
28
|
name: string;
|
|
29
29
|
/**
|
|
30
|
-
* MoneyMQ
|
|
30
|
+
* MoneyMQ product ID for this metric
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
productId: string;
|
|
33
33
|
/**
|
|
34
34
|
* Human-readable display name
|
|
35
35
|
*/
|
|
@@ -254,8 +254,8 @@ interface CreateCheckoutParams {
|
|
|
254
254
|
* usage: {
|
|
255
255
|
* enabled: true,
|
|
256
256
|
* metrics: [
|
|
257
|
-
* { name: 'api_calls',
|
|
258
|
-
* { name: 'storage',
|
|
257
|
+
* { name: 'api_calls', productId: 'api-calls-metered', unit: 'requests' },
|
|
258
|
+
* { name: 'storage', productId: 'storage-metered', unit: 'GB' },
|
|
259
259
|
* ],
|
|
260
260
|
* },
|
|
261
261
|
* }),
|
|
@@ -340,7 +340,7 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
|
|
|
340
340
|
url: string;
|
|
341
341
|
sessionId: string;
|
|
342
342
|
lineItems: {
|
|
343
|
-
|
|
343
|
+
productId: string;
|
|
344
344
|
quantity: number;
|
|
345
345
|
}[];
|
|
346
346
|
totalRecords: number;
|
|
@@ -349,14 +349,17 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
|
|
|
349
349
|
method: "POST";
|
|
350
350
|
body: z.ZodObject<{
|
|
351
351
|
lineItems: z.ZodArray<z.ZodObject<{
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
productId: z.ZodString;
|
|
353
|
+
experimentId: z.ZodOptional<z.ZodString>;
|
|
354
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
354
355
|
}, "strip", z.ZodTypeAny, {
|
|
355
|
-
|
|
356
|
-
|
|
356
|
+
productId: string;
|
|
357
|
+
quantity?: number | undefined;
|
|
358
|
+
experimentId?: string | undefined;
|
|
357
359
|
}, {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
productId: string;
|
|
361
|
+
quantity?: number | undefined;
|
|
362
|
+
experimentId?: string | undefined;
|
|
360
363
|
}>, "many">;
|
|
361
364
|
successUrl: z.ZodString;
|
|
362
365
|
cancelUrl: z.ZodString;
|
|
@@ -365,16 +368,18 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
|
|
|
365
368
|
successUrl: string;
|
|
366
369
|
cancelUrl: string;
|
|
367
370
|
lineItems: {
|
|
368
|
-
|
|
369
|
-
|
|
371
|
+
productId: string;
|
|
372
|
+
quantity?: number | undefined;
|
|
373
|
+
experimentId?: string | undefined;
|
|
370
374
|
}[];
|
|
371
375
|
metadata?: Record<string, string> | undefined;
|
|
372
376
|
}, {
|
|
373
377
|
successUrl: string;
|
|
374
378
|
cancelUrl: string;
|
|
375
379
|
lineItems: {
|
|
376
|
-
|
|
377
|
-
|
|
380
|
+
productId: string;
|
|
381
|
+
quantity?: number | undefined;
|
|
382
|
+
experimentId?: string | undefined;
|
|
378
383
|
}[];
|
|
379
384
|
metadata?: Record<string, string> | undefined;
|
|
380
385
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -4316,7 +4316,7 @@ var moneymq = (options) => {
|
|
|
4316
4316
|
if (!metricTotals[record.metric]) {
|
|
4317
4317
|
metricTotals[record.metric] = {
|
|
4318
4318
|
quantity: 0,
|
|
4319
|
-
|
|
4319
|
+
productId: metricConfig.productId,
|
|
4320
4320
|
recordIds: []
|
|
4321
4321
|
};
|
|
4322
4322
|
}
|
|
@@ -4334,7 +4334,7 @@ var moneymq = (options) => {
|
|
|
4334
4334
|
metricTotals[record.metric].recordIds.push(record.id);
|
|
4335
4335
|
}
|
|
4336
4336
|
const lineItems = Object.values(metricTotals).map((m) => ({
|
|
4337
|
-
|
|
4337
|
+
productId: m.productId,
|
|
4338
4338
|
quantity: Math.ceil(m.quantity)
|
|
4339
4339
|
}));
|
|
4340
4340
|
const allRecordIds = Object.values(metricTotals).flatMap((m) => m.recordIds);
|
|
@@ -4365,8 +4365,9 @@ var moneymq = (options) => {
|
|
|
4365
4365
|
body: z.object({
|
|
4366
4366
|
lineItems: z.array(
|
|
4367
4367
|
z.object({
|
|
4368
|
-
|
|
4369
|
-
|
|
4368
|
+
productId: z.string(),
|
|
4369
|
+
experimentId: z.string().optional(),
|
|
4370
|
+
quantity: z.number().positive().optional()
|
|
4370
4371
|
})
|
|
4371
4372
|
),
|
|
4372
4373
|
successUrl: z.string(),
|