@connect-plus-online/ogabai-integrations 0.0.104 → 0.0.106
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.js +108 -94
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +51 -28
- package/dist/index.d.ts +51 -28
- package/dist/index.esm.js +108 -94
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var graphqlClient = require('@chijioke/graphql-client');
|
|
4
|
+
|
|
3
5
|
// src/types/user.ts
|
|
4
6
|
var AppNewFeatures = /* @__PURE__ */ ((AppNewFeatures2) => {
|
|
5
7
|
AppNewFeatures2["ExpenseTracker"] = "expenseTracker";
|
|
@@ -1380,6 +1382,9 @@ var meResponseNestedFields = {
|
|
|
1380
1382
|
|
|
1381
1383
|
// src/services/user/user.service.ts
|
|
1382
1384
|
var createUserService = (client) => ({
|
|
1385
|
+
async featureTestPhase(featureName, testFeatures) {
|
|
1386
|
+
return testFeatures.includes(featureName);
|
|
1387
|
+
},
|
|
1383
1388
|
async getTestFeatureEnabled(fetchFields, option) {
|
|
1384
1389
|
var _a, _b;
|
|
1385
1390
|
const res = await client.request(
|
|
@@ -3525,35 +3530,8 @@ var updateTransactionResponse = getTransactionResponse;
|
|
|
3525
3530
|
var updateTransactionResponseNestedFields = getTransactionResponseNestedFields;
|
|
3526
3531
|
|
|
3527
3532
|
// src/services/sales/transaction.service.ts
|
|
3528
|
-
var createTransactionService = (client) =>
|
|
3529
|
-
|
|
3530
|
-
* Uploads a transaction receipt
|
|
3531
|
-
* @param form {
|
|
3532
|
-
* file: File;
|
|
3533
|
-
* transactionId: string;
|
|
3534
|
-
* storeId: string;
|
|
3535
|
-
* }
|
|
3536
|
-
* @returns Transaction with updated receipt URL
|
|
3537
|
-
*/
|
|
3538
|
-
async uploadExpenseReceipt(form) {
|
|
3539
|
-
const fileClient = createFileService(client);
|
|
3540
|
-
return (await fileClient.uploadTxReceipt(form)).transaction;
|
|
3541
|
-
},
|
|
3542
|
-
async updateTransaction(input, fetchFields, option) {
|
|
3543
|
-
var _a, _b, _c, _d;
|
|
3544
|
-
const res = await client.request(
|
|
3545
|
-
transactionSchema.updateTransaction(
|
|
3546
|
-
gqlQueryStringBuilder(
|
|
3547
|
-
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
|
|
3548
|
-
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
|
|
3549
|
-
)
|
|
3550
|
-
),
|
|
3551
|
-
input,
|
|
3552
|
-
option
|
|
3553
|
-
);
|
|
3554
|
-
return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
|
|
3555
|
-
},
|
|
3556
|
-
async addTransaction(input, fetchFields, option) {
|
|
3533
|
+
var createTransactionService = (client) => {
|
|
3534
|
+
async function addTransaction(input, fetchFields, option) {
|
|
3557
3535
|
var _a, _b, _c, _d;
|
|
3558
3536
|
const res = await client.request(
|
|
3559
3537
|
transactionSchema.addTransaction(
|
|
@@ -3566,98 +3544,134 @@ var createTransactionService = (client) => ({
|
|
|
3566
3544
|
option
|
|
3567
3545
|
);
|
|
3568
3546
|
return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
|
|
3569
|
-
},
|
|
3570
|
-
async addCustomerDeposit(input, fetchFields, option) {
|
|
3571
|
-
return this.addTransaction(
|
|
3572
|
-
{
|
|
3573
|
-
transaction: {
|
|
3574
|
-
...input,
|
|
3575
|
-
transactionType: "customerDeposit",
|
|
3576
|
-
platform: "pos"
|
|
3577
|
-
}
|
|
3578
|
-
},
|
|
3579
|
-
fetchFields,
|
|
3580
|
-
option
|
|
3581
|
-
);
|
|
3582
|
-
},
|
|
3583
|
-
async addCustomerRefund(input, fetchFields, option) {
|
|
3584
|
-
return this.addTransaction(
|
|
3585
|
-
{
|
|
3586
|
-
transaction: {
|
|
3587
|
-
...input,
|
|
3588
|
-
transactionType: "customerRefund",
|
|
3589
|
-
platform: "pos"
|
|
3590
|
-
}
|
|
3591
|
-
},
|
|
3592
|
-
fetchFields,
|
|
3593
|
-
option
|
|
3594
|
-
);
|
|
3595
|
-
},
|
|
3596
|
-
async getTransaction(input, fetchFields, option) {
|
|
3597
|
-
var _a, _b, _c, _d;
|
|
3598
|
-
const res = await client.request(
|
|
3599
|
-
transactionSchema.getTransaction(
|
|
3600
|
-
gqlQueryStringBuilder(
|
|
3601
|
-
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
|
|
3602
|
-
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
|
|
3603
|
-
)
|
|
3604
|
-
),
|
|
3605
|
-
input,
|
|
3606
|
-
option
|
|
3607
|
-
);
|
|
3608
|
-
return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
|
|
3609
|
-
},
|
|
3610
|
-
async getTransactions(input, fetchFields, option) {
|
|
3611
|
-
var _a, _b, _c, _d;
|
|
3612
|
-
const res = await client.request(
|
|
3613
|
-
transactionSchema.getTransactions(
|
|
3614
|
-
gqlQueryStringBuilder(
|
|
3615
|
-
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
|
|
3616
|
-
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
|
|
3617
|
-
)
|
|
3618
|
-
),
|
|
3619
|
-
input,
|
|
3620
|
-
option
|
|
3621
|
-
);
|
|
3622
|
-
return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
|
|
3623
3547
|
}
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3548
|
+
return {
|
|
3549
|
+
/**
|
|
3550
|
+
*
|
|
3551
|
+
* @param input transactionRequest
|
|
3552
|
+
* @param fetchFields filter what is returned (fields)
|
|
3553
|
+
* @param option call options - cache
|
|
3554
|
+
* @returns TransactionResponse
|
|
3555
|
+
*/
|
|
3556
|
+
async returnSales(input, fetchFields, option) {
|
|
3557
|
+
return addTransaction(input, fetchFields, option);
|
|
3558
|
+
},
|
|
3559
|
+
/**
|
|
3560
|
+
* Uploads a transaction receipt
|
|
3561
|
+
* @param form {
|
|
3562
|
+
* file: File;
|
|
3563
|
+
* transactionId: string;
|
|
3564
|
+
* storeId: string;
|
|
3565
|
+
* }
|
|
3566
|
+
* @returns Transaction with updated receipt URL
|
|
3567
|
+
*/
|
|
3568
|
+
async uploadExpenseReceipt(form) {
|
|
3569
|
+
const fileClient = createFileService(client);
|
|
3570
|
+
return (await fileClient.uploadTxReceipt(form)).transaction;
|
|
3571
|
+
},
|
|
3572
|
+
async updateTransaction(input, fetchFields, option) {
|
|
3573
|
+
var _a, _b, _c, _d;
|
|
3574
|
+
const res = await client.request(
|
|
3575
|
+
transactionSchema.updateTransaction(
|
|
3576
|
+
gqlQueryStringBuilder(
|
|
3577
|
+
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
|
|
3578
|
+
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
|
|
3579
|
+
)
|
|
3580
|
+
),
|
|
3581
|
+
input,
|
|
3582
|
+
option
|
|
3583
|
+
);
|
|
3584
|
+
return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
|
|
3585
|
+
},
|
|
3586
|
+
addTransaction,
|
|
3587
|
+
async addCustomerDeposit(input, fetchFields, option) {
|
|
3588
|
+
return this.addTransaction(
|
|
3589
|
+
{
|
|
3590
|
+
transaction: {
|
|
3591
|
+
...input,
|
|
3592
|
+
transactionType: "customerDeposit",
|
|
3593
|
+
platform: "pos"
|
|
3594
|
+
}
|
|
3595
|
+
},
|
|
3596
|
+
fetchFields,
|
|
3597
|
+
option
|
|
3598
|
+
);
|
|
3599
|
+
},
|
|
3600
|
+
async addCustomerRefund(input, fetchFields, option) {
|
|
3601
|
+
return this.addTransaction(
|
|
3602
|
+
{
|
|
3603
|
+
transaction: {
|
|
3604
|
+
...input,
|
|
3605
|
+
transactionType: "customerRefund",
|
|
3606
|
+
platform: "pos"
|
|
3607
|
+
}
|
|
3608
|
+
},
|
|
3609
|
+
fetchFields,
|
|
3610
|
+
option
|
|
3611
|
+
);
|
|
3612
|
+
},
|
|
3613
|
+
async getTransaction(input, fetchFields, option) {
|
|
3614
|
+
var _a, _b, _c, _d;
|
|
3615
|
+
const res = await client.request(
|
|
3616
|
+
transactionSchema.getTransaction(
|
|
3617
|
+
gqlQueryStringBuilder(
|
|
3618
|
+
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
|
|
3619
|
+
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
|
|
3620
|
+
)
|
|
3621
|
+
),
|
|
3622
|
+
input,
|
|
3623
|
+
option
|
|
3624
|
+
);
|
|
3625
|
+
return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
|
|
3626
|
+
},
|
|
3627
|
+
async getTransactions(input, fetchFields, option) {
|
|
3628
|
+
var _a, _b, _c, _d;
|
|
3629
|
+
const res = await client.request(
|
|
3630
|
+
transactionSchema.getTransactions(
|
|
3631
|
+
gqlQueryStringBuilder(
|
|
3632
|
+
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
|
|
3633
|
+
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
|
|
3634
|
+
)
|
|
3635
|
+
),
|
|
3636
|
+
input,
|
|
3637
|
+
option
|
|
3638
|
+
);
|
|
3639
|
+
return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
|
|
3640
|
+
}
|
|
3641
|
+
};
|
|
3642
|
+
};
|
|
3627
3643
|
var ENTITY8 = "expenseCategory";
|
|
3628
|
-
var expenseCategoryIntegration = createStandardEntityIntegration({
|
|
3644
|
+
var expenseCategoryIntegration = graphqlClient.createStandardEntityIntegration({
|
|
3629
3645
|
key: ENTITY8,
|
|
3630
3646
|
fields: expenseCategoryQuery,
|
|
3631
3647
|
nested: {
|
|
3632
3648
|
features: expenseCategoryQuery
|
|
3633
3649
|
}
|
|
3634
3650
|
});
|
|
3635
|
-
var expenseCategoryListIntegration = createListIntegration({
|
|
3651
|
+
var expenseCategoryListIntegration = graphqlClient.createListIntegration({
|
|
3636
3652
|
key: ENTITY8,
|
|
3637
3653
|
fields: expenseCategoryQuery,
|
|
3638
3654
|
nested: {
|
|
3639
3655
|
features: expenseCategoryQuery
|
|
3640
3656
|
}
|
|
3641
3657
|
});
|
|
3642
|
-
var expenseCategoryDeleteIntegration = createDeleteIntegration(ENTITY8);
|
|
3643
|
-
|
|
3644
|
-
// src/services/sales/types/expense.type.ts
|
|
3658
|
+
var expenseCategoryDeleteIntegration = graphqlClient.createDeleteIntegration(ENTITY8);
|
|
3645
3659
|
var ENTITY9 = "expense";
|
|
3646
|
-
var expenseIntegration = createStandardEntityIntegration({
|
|
3660
|
+
var expenseIntegration = graphqlClient.createStandardEntityIntegration({
|
|
3647
3661
|
key: ENTITY9,
|
|
3648
3662
|
fields: expenseQuery,
|
|
3649
3663
|
nested: {
|
|
3650
3664
|
features: expenseQuery
|
|
3651
3665
|
}
|
|
3652
3666
|
});
|
|
3653
|
-
var expenseListIntegration = createListIntegration({
|
|
3667
|
+
var expenseListIntegration = graphqlClient.createListIntegration({
|
|
3654
3668
|
key: ENTITY9,
|
|
3655
3669
|
fields: expenseQuery,
|
|
3656
3670
|
nested: {
|
|
3657
3671
|
features: expenseQuery
|
|
3658
3672
|
}
|
|
3659
3673
|
});
|
|
3660
|
-
var expenseDeleteIntegration = createDeleteIntegration(ENTITY9);
|
|
3674
|
+
var expenseDeleteIntegration = graphqlClient.createDeleteIntegration(ENTITY9);
|
|
3661
3675
|
|
|
3662
3676
|
// src/services/sales/schemas/expense-category.schema.ts
|
|
3663
3677
|
var expenseCategorySchema = {
|