@bisondesk/documents-sdk 1.0.554 → 1.0.555

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.
@@ -27,10 +27,16 @@ export type MaxAmountSupplierRuleConfig = {
27
27
  export type MaxAmountRuleConfig = {
28
28
  maxAmount: string;
29
29
  };
30
+ export type PurchasePriceRuleConfig = {
31
+ tolerance?: number;
32
+ };
30
33
  export type RuleConfig = {
31
34
  categoryId?: string;
32
35
  } & ({
33
- ruleId: ValidationRuleType.AlwaysBlock | ValidationRuleType.CommissionCost | ValidationRuleType.GarageCostInternal | ValidationRuleType.GarageCostExternal | ValidationRuleType.PurchasePrice | ValidationRuleType.RemarksBlock | ValidationRuleType.TransportCostInternal | ValidationRuleType.TransportCostExternal;
36
+ ruleId: ValidationRuleType.AlwaysBlock | ValidationRuleType.CommissionCost | ValidationRuleType.GarageCostInternal | ValidationRuleType.GarageCostExternal | ValidationRuleType.RemarksBlock | ValidationRuleType.TransportCostInternal | ValidationRuleType.TransportCostExternal;
37
+ } | {
38
+ ruleId: ValidationRuleType.PurchasePrice;
39
+ config?: PurchasePriceRuleConfig;
34
40
  } | {
35
41
  ruleId: ValidationRuleType.MaxAmount;
36
42
  config: MaxAmountRuleConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"/","sources":["types/rules.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAC5B,WAAW,sBAAsB;IACjC,cAAc,yBAAyB;IACvC,kBAAkB,8BAA8B;IAChD,kBAAkB,8BAA8B;IAChD,SAAS,oBAAoB;IAC7B,iBAAiB,6BAA6B;IAC9C,aAAa,wBAAwB;IACrC,uBAAuB,mCAAmC;IAC1D,YAAY,uBAAuB;IACnC,qBAAqB,iCAAiC;IACtD,qBAAqB,iCAAiC;CACvD;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,EAAE;QACT,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,CA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CAAC;IACnD,MAAM,EAAE,iCAAiC,CAAC;CAC3C,CACJ,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,EAAE,CAAC;CAC1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"/","sources":["types/rules.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,kBAYX;AAZD,WAAY,kBAAkB;IAC5B,uDAAiC,CAAA;IACjC,6DAAuC,CAAA;IACvC,sEAAgD,CAAA;IAChD,sEAAgD,CAAA;IAChD,mDAA6B,CAAA;IAC7B,oEAA8C,CAAA;IAC9C,2DAAqC,CAAA;IACrC,gFAA0D,CAAA;IAC1D,yDAAmC,CAAA;IACnC,4EAAsD,CAAA;IACtD,4EAAsD,CAAA;AACxD,CAAC,EAZW,kBAAkB,KAAlB,kBAAkB,QAY7B","sourcesContent":["export enum ValidationRuleType {\n AlwaysBlock = 'always-block-rule',\n CommissionCost = 'commission-cost-rule',\n GarageCostExternal = 'garage-cost-external-rule',\n GarageCostInternal = 'garage-cost-internal-rule',\n MaxAmount = 'max-amount-rule',\n MaxAmountSupplier = 'max-amount-supplier-rule',\n PurchasePrice = 'purchase-price-rule',\n RecurrentVehicleInvoice = 'recurrent-vehicle-invoice-rule',\n RemarksBlock = 'remarks-block-rule',\n TransportCostExternal = 'transport-cost-external-rule',\n TransportCostInternal = 'transport-cost-internal-rule',\n}\n\nexport type RecurrentVehicleInvoiceRuleConfig = {\n suppliers: {\n id: string;\n description?: string;\n }[];\n};\n\nexport type MaxAmountSupplierRuleConfig = {\n suppliers: {\n id: string;\n maxAmount: string;\n description?: string;\n }[];\n};\n\nexport type MaxAmountRuleConfig = {\n maxAmount: string;\n};\n\nexport type RuleConfig = { categoryId?: string } & (\n | {\n ruleId:\n | ValidationRuleType.AlwaysBlock\n | ValidationRuleType.CommissionCost\n | ValidationRuleType.GarageCostInternal\n | ValidationRuleType.GarageCostExternal\n | ValidationRuleType.PurchasePrice\n | ValidationRuleType.RemarksBlock\n | ValidationRuleType.TransportCostInternal\n | ValidationRuleType.TransportCostExternal;\n }\n | {\n ruleId: ValidationRuleType.MaxAmount;\n config: MaxAmountRuleConfig;\n }\n | {\n ruleId: ValidationRuleType.MaxAmountSupplier;\n config: MaxAmountSupplierRuleConfig;\n }\n | {\n ruleId: ValidationRuleType.RecurrentVehicleInvoice;\n config: RecurrentVehicleInvoiceRuleConfig;\n }\n);\n\nexport type ValidationRulesConfigs = {\n business: RuleConfig[];\n accounting: RuleConfig[];\n};\n"]}
1
+ {"version":3,"file":"rules.js","sourceRoot":"/","sources":["types/rules.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,kBAYX;AAZD,WAAY,kBAAkB;IAC5B,uDAAiC,CAAA;IACjC,6DAAuC,CAAA;IACvC,sEAAgD,CAAA;IAChD,sEAAgD,CAAA;IAChD,mDAA6B,CAAA;IAC7B,oEAA8C,CAAA;IAC9C,2DAAqC,CAAA;IACrC,gFAA0D,CAAA;IAC1D,yDAAmC,CAAA;IACnC,4EAAsD,CAAA;IACtD,4EAAsD,CAAA;AACxD,CAAC,EAZW,kBAAkB,KAAlB,kBAAkB,QAY7B","sourcesContent":["export enum ValidationRuleType {\n AlwaysBlock = 'always-block-rule',\n CommissionCost = 'commission-cost-rule',\n GarageCostExternal = 'garage-cost-external-rule',\n GarageCostInternal = 'garage-cost-internal-rule',\n MaxAmount = 'max-amount-rule',\n MaxAmountSupplier = 'max-amount-supplier-rule',\n PurchasePrice = 'purchase-price-rule',\n RecurrentVehicleInvoice = 'recurrent-vehicle-invoice-rule',\n RemarksBlock = 'remarks-block-rule',\n TransportCostExternal = 'transport-cost-external-rule',\n TransportCostInternal = 'transport-cost-internal-rule',\n}\n\nexport type RecurrentVehicleInvoiceRuleConfig = {\n suppliers: {\n id: string;\n description?: string;\n }[];\n};\n\nexport type MaxAmountSupplierRuleConfig = {\n suppliers: {\n id: string;\n maxAmount: string;\n description?: string;\n }[];\n};\n\nexport type MaxAmountRuleConfig = {\n maxAmount: string;\n};\n\nexport type PurchasePriceRuleConfig = {\n tolerance?: number;\n};\n\nexport type RuleConfig = { categoryId?: string } & (\n | {\n ruleId:\n | ValidationRuleType.AlwaysBlock\n | ValidationRuleType.CommissionCost\n | ValidationRuleType.GarageCostInternal\n | ValidationRuleType.GarageCostExternal\n | ValidationRuleType.RemarksBlock\n | ValidationRuleType.TransportCostInternal\n | ValidationRuleType.TransportCostExternal;\n }\n | {\n ruleId: ValidationRuleType.PurchasePrice;\n config?: PurchasePriceRuleConfig;\n }\n | {\n ruleId: ValidationRuleType.MaxAmount;\n config: MaxAmountRuleConfig;\n }\n | {\n ruleId: ValidationRuleType.MaxAmountSupplier;\n config: MaxAmountSupplierRuleConfig;\n }\n | {\n ruleId: ValidationRuleType.RecurrentVehicleInvoice;\n config: RecurrentVehicleInvoiceRuleConfig;\n }\n);\n\nexport type ValidationRulesConfigs = {\n business: RuleConfig[];\n accounting: RuleConfig[];\n};\n"]}
@@ -1,7 +1,9 @@
1
1
  import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';
2
+ import { Vehicle } from '@bisondesk/core-sdk/types/vehicles';
2
3
  import { GlobalBusinessEntity, GlobalSearchEntity } from '@bisondesk/core-sdk/utils/search';
3
4
  import { Association } from '../types/documents.js';
4
5
  export type SupportedAssociationEntity = GlobalBusinessEntity;
5
6
  export declare const getAssociationForBusinessEntity: (businessEntityId: BusinessEntityIds, record: SupportedAssociationEntity) => Association;
6
7
  export declare const getAssociationForSearchBusinessEntity: (businessEntityId: BusinessEntityIds, entity: GlobalSearchEntity) => Association;
8
+ export declare const getExternalVehicleSaleAssociation: (vehicle: Vehicle, externalSaleId: string) => Association;
7
9
  //# sourceMappingURL=associations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"associations.d.ts","sourceRoot":"/","sources":["utils/associations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAQnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE9D,eAAO,MAAM,+BAA+B,GAC1C,kBAAkB,iBAAiB,EACnC,QAAQ,0BAA0B,KACjC,WAMD,CAAC;AAEH,eAAO,MAAM,qCAAqC,GAChD,kBAAkB,iBAAiB,EACnC,QAAQ,kBAAkB,KACzB,WASF,CAAC"}
1
+ {"version":3,"file":"associations.d.ts","sourceRoot":"/","sources":["utils/associations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAQnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE9D,eAAO,MAAM,+BAA+B,GAC1C,kBAAkB,iBAAiB,EACnC,QAAQ,0BAA0B,KACjC,WAMD,CAAC;AAEH,eAAO,MAAM,qCAAqC,GAChD,kBAAkB,iBAAiB,EACnC,QAAQ,kBAAkB,KACzB,WASF,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAC5C,SAAS,OAAO,EAChB,gBAAgB,MAAM,KACrB,WAQD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';
1
2
  import { getDescriptionForBusinessEntity, getDescriptionForSearchBusinessEntity, getMainEntityFromSearchEntity, getTagsForBusinessEntity, getTagsForSearchBusinessEntity, getTitleForBusinessEntity, getTitleForSearchBusinessEntity, } from '@bisondesk/core-sdk/utils/search';
2
3
  export const getAssociationForBusinessEntity = (businessEntityId, record) => ({
3
4
  businessEntityId,
@@ -16,4 +17,13 @@ export const getAssociationForSearchBusinessEntity = (businessEntityId, entity)
16
17
  tags: getTagsForSearchBusinessEntity(businessEntityId, entity),
17
18
  };
18
19
  };
20
+ export const getExternalVehicleSaleAssociation = (vehicle, externalSaleId) => ({
21
+ ...getAssociationForBusinessEntity(BusinessEntityIds.Vehicles, vehicle),
22
+ businessEntityId: BusinessEntityIds.ExternalVehicleSale,
23
+ recordId: externalSaleId,
24
+ linkTo: {
25
+ businessEntityId: BusinessEntityIds.Vehicles,
26
+ recordId: vehicle.id,
27
+ },
28
+ });
19
29
  //# sourceMappingURL=associations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"associations.js","sourceRoot":"/","sources":["utils/associations.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,+BAA+B,EAC/B,qCAAqC,EACrC,6BAA6B,EAC7B,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,+BAA+B,GAChC,MAAM,kCAAkC,CAAC;AAK1C,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,gBAAmC,EACnC,MAAkC,EACrB,EAAE,CAAC,CAAC;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC,EAAE;IACnB,KAAK,EAAE,yBAAyB,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC1D,WAAW,EAAE,+BAA+B,CAAC,gBAAgB,EAAE,MAAM,CAAC;IACtE,IAAI,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACzD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,gBAAmC,EACnC,MAA0B,EACb,EAAE;IACf,MAAM,MAAM,GAAG,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACvE,OAAO;QACL,gBAAgB;QAChB,QAAQ,EAAE,MAAM,CAAC,EAAE;QACnB,KAAK,EAAE,+BAA+B,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAChE,WAAW,EAAE,qCAAqC,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAC5E,IAAI,EAAE,8BAA8B,CAAC,gBAAgB,EAAE,MAAM,CAAC;KAC/D,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';\nimport {\n GlobalBusinessEntity,\n GlobalSearchEntity,\n getDescriptionForBusinessEntity,\n getDescriptionForSearchBusinessEntity,\n getMainEntityFromSearchEntity,\n getTagsForBusinessEntity,\n getTagsForSearchBusinessEntity,\n getTitleForBusinessEntity,\n getTitleForSearchBusinessEntity,\n} from '@bisondesk/core-sdk/utils/search';\nimport { Association } from '../types/documents.js';\n\nexport type SupportedAssociationEntity = GlobalBusinessEntity;\n\nexport const getAssociationForBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n record: SupportedAssociationEntity\n): Association => ({\n businessEntityId,\n recordId: record.id,\n title: getTitleForBusinessEntity(businessEntityId, record),\n description: getDescriptionForBusinessEntity(businessEntityId, record),\n tags: getTagsForBusinessEntity(businessEntityId, record),\n});\n\nexport const getAssociationForSearchBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalSearchEntity\n): Association => {\n const record = getMainEntityFromSearchEntity(businessEntityId, entity);\n return {\n businessEntityId,\n recordId: record.id,\n title: getTitleForSearchBusinessEntity(businessEntityId, entity),\n description: getDescriptionForSearchBusinessEntity(businessEntityId, entity),\n tags: getTagsForSearchBusinessEntity(businessEntityId, entity),\n };\n};\n"]}
1
+ {"version":3,"file":"associations.js","sourceRoot":"/","sources":["utils/associations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAGL,+BAA+B,EAC/B,qCAAqC,EACrC,6BAA6B,EAC7B,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,+BAA+B,GAChC,MAAM,kCAAkC,CAAC;AAK1C,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,gBAAmC,EACnC,MAAkC,EACrB,EAAE,CAAC,CAAC;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC,EAAE;IACnB,KAAK,EAAE,yBAAyB,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC1D,WAAW,EAAE,+BAA+B,CAAC,gBAAgB,EAAE,MAAM,CAAC;IACtE,IAAI,EAAE,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACzD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,gBAAmC,EACnC,MAA0B,EACb,EAAE;IACf,MAAM,MAAM,GAAG,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACvE,OAAO;QACL,gBAAgB;QAChB,QAAQ,EAAE,MAAM,CAAC,EAAE;QACnB,KAAK,EAAE,+BAA+B,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAChE,WAAW,EAAE,qCAAqC,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAC5E,IAAI,EAAE,8BAA8B,CAAC,gBAAgB,EAAE,MAAM,CAAC;KAC/D,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,OAAgB,EAChB,cAAsB,EACT,EAAE,CAAC,CAAC;IACjB,GAAG,+BAA+B,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC;IACvE,gBAAgB,EAAE,iBAAiB,CAAC,mBAAmB;IACvD,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE;QACN,gBAAgB,EAAE,iBAAiB,CAAC,QAAQ;QAC5C,QAAQ,EAAE,OAAO,CAAC,EAAE;KACrB;CACF,CAAC,CAAC","sourcesContent":["import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';\nimport { Vehicle } from '@bisondesk/core-sdk/types/vehicles';\nimport {\n GlobalBusinessEntity,\n GlobalSearchEntity,\n getDescriptionForBusinessEntity,\n getDescriptionForSearchBusinessEntity,\n getMainEntityFromSearchEntity,\n getTagsForBusinessEntity,\n getTagsForSearchBusinessEntity,\n getTitleForBusinessEntity,\n getTitleForSearchBusinessEntity,\n} from '@bisondesk/core-sdk/utils/search';\nimport { Association } from '../types/documents.js';\n\nexport type SupportedAssociationEntity = GlobalBusinessEntity;\n\nexport const getAssociationForBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n record: SupportedAssociationEntity\n): Association => ({\n businessEntityId,\n recordId: record.id,\n title: getTitleForBusinessEntity(businessEntityId, record),\n description: getDescriptionForBusinessEntity(businessEntityId, record),\n tags: getTagsForBusinessEntity(businessEntityId, record),\n});\n\nexport const getAssociationForSearchBusinessEntity = (\n businessEntityId: BusinessEntityIds,\n entity: GlobalSearchEntity\n): Association => {\n const record = getMainEntityFromSearchEntity(businessEntityId, entity);\n return {\n businessEntityId,\n recordId: record.id,\n title: getTitleForSearchBusinessEntity(businessEntityId, entity),\n description: getDescriptionForSearchBusinessEntity(businessEntityId, entity),\n tags: getTagsForSearchBusinessEntity(businessEntityId, entity),\n };\n};\n\nexport const getExternalVehicleSaleAssociation = (\n vehicle: Vehicle,\n externalSaleId: string\n): Association => ({\n ...getAssociationForBusinessEntity(BusinessEntityIds.Vehicles, vehicle),\n businessEntityId: BusinessEntityIds.ExternalVehicleSale,\n recordId: externalSaleId,\n linkTo: {\n businessEntityId: BusinessEntityIds.Vehicles,\n recordId: vehicle.id,\n },\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bisondesk/documents-sdk",
3
- "version": "1.0.554",
3
+ "version": "1.0.555",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -31,6 +31,10 @@ export type MaxAmountRuleConfig = {
31
31
  maxAmount: string;
32
32
  };
33
33
 
34
+ export type PurchasePriceRuleConfig = {
35
+ tolerance?: number;
36
+ };
37
+
34
38
  export type RuleConfig = { categoryId?: string } & (
35
39
  | {
36
40
  ruleId:
@@ -38,11 +42,14 @@ export type RuleConfig = { categoryId?: string } & (
38
42
  | ValidationRuleType.CommissionCost
39
43
  | ValidationRuleType.GarageCostInternal
40
44
  | ValidationRuleType.GarageCostExternal
41
- | ValidationRuleType.PurchasePrice
42
45
  | ValidationRuleType.RemarksBlock
43
46
  | ValidationRuleType.TransportCostInternal
44
47
  | ValidationRuleType.TransportCostExternal;
45
48
  }
49
+ | {
50
+ ruleId: ValidationRuleType.PurchasePrice;
51
+ config?: PurchasePriceRuleConfig;
52
+ }
46
53
  | {
47
54
  ruleId: ValidationRuleType.MaxAmount;
48
55
  config: MaxAmountRuleConfig;
@@ -1,4 +1,5 @@
1
1
  import { BusinessEntityIds } from '@bisondesk/commons-sdk/constants';
2
+ import { Vehicle } from '@bisondesk/core-sdk/types/vehicles';
2
3
  import {
3
4
  GlobalBusinessEntity,
4
5
  GlobalSearchEntity,
@@ -38,3 +39,16 @@ export const getAssociationForSearchBusinessEntity = (
38
39
  tags: getTagsForSearchBusinessEntity(businessEntityId, entity),
39
40
  };
40
41
  };
42
+
43
+ export const getExternalVehicleSaleAssociation = (
44
+ vehicle: Vehicle,
45
+ externalSaleId: string
46
+ ): Association => ({
47
+ ...getAssociationForBusinessEntity(BusinessEntityIds.Vehicles, vehicle),
48
+ businessEntityId: BusinessEntityIds.ExternalVehicleSale,
49
+ recordId: externalSaleId,
50
+ linkTo: {
51
+ businessEntityId: BusinessEntityIds.Vehicles,
52
+ recordId: vehicle.id,
53
+ },
54
+ });