sinfactura-types 1.6.42 → 1.6.44

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.ts CHANGED
@@ -15,10 +15,12 @@ export * from "./imports";
15
15
  export * from "./invoice";
16
16
  export * from "./log";
17
17
  export * from "./maintenance";
18
+ export * from "./mercadolibre";
18
19
  export * from "./mercadopago";
19
20
  export * from "./notification";
20
21
  export * from "./order";
21
22
  export * from "./payment";
23
+ export * from "./platform";
22
24
  export * from "./pricing";
23
25
  export * from "./print";
24
26
  export * from "./product";
package/dist/index.js CHANGED
@@ -15,10 +15,12 @@ export * from "./imports";
15
15
  export * from "./invoice";
16
16
  export * from "./log";
17
17
  export * from "./maintenance";
18
+ export * from "./mercadolibre";
18
19
  export * from "./mercadopago";
19
20
  export * from "./notification";
20
21
  export * from "./order";
21
22
  export * from "./payment";
23
+ export * from "./platform";
22
24
  export * from "./pricing";
23
25
  export * from "./print";
24
26
  export * from "./product";
@@ -0,0 +1,65 @@
1
+ declare global {
2
+ interface MlOauthTokenResponse {
3
+ access_token: string;
4
+ token_type?: string;
5
+ expires_in: number;
6
+ scope?: string;
7
+ user_id: number;
8
+ refresh_token: string;
9
+ }
10
+ interface MlOauthInitiateResponse {
11
+ authorizationUrl: string;
12
+ }
13
+ interface MlOauthCallbackResponse {
14
+ connected: true;
15
+ storeId: string;
16
+ mercadolibreUserId: string;
17
+ expiresAt: number;
18
+ connectedAt: number;
19
+ }
20
+ type MlOauthErrorCode = "OAUTH_USER_DENIED" | "OAUTH_STATE_MISMATCH" | "OAUTH_EXCHANGE_FAILED" | "ML_OAUTH_NOT_CONFIGURED" | "ML_REDIRECT_URI_MISMATCH" | "ML_OFFLINE_ACCESS_NOT_GRANTED" | "ML_OPERATOR_SUB_ACCOUNT";
21
+ interface MercadolibreStatus {
22
+ connected: boolean;
23
+ status: MercadolibreConnectionStatus;
24
+ userId?: string;
25
+ nickname?: string;
26
+ connectedAt?: number;
27
+ expiresAt?: number;
28
+ autoInvoice?: boolean;
29
+ defaultPosId?: number;
30
+ syncPolicy?: Mercadolibre["syncPolicy"];
31
+ }
32
+ interface MlWebhookEvent {
33
+ _id: string;
34
+ resource: string;
35
+ user_id: number;
36
+ topic: string;
37
+ application_id: number;
38
+ attempts: number;
39
+ sent: string;
40
+ received: string;
41
+ }
42
+ type MlMatchGrade = "vinculada" | "para-revisar" | "sin-vincular";
43
+ type MlMatchBasis = "seller_sku" | "gtin" | "title";
44
+ interface MlMatchSuggestion {
45
+ productId: string;
46
+ sku?: string;
47
+ mlItemId: string;
48
+ mlTitle?: string;
49
+ userProductId?: string;
50
+ familyId?: string;
51
+ variationId?: string;
52
+ grade: MlMatchGrade;
53
+ basis?: MlMatchBasis;
54
+ }
55
+ interface MercadolibreOrderWsPayload {
56
+ orderId: string;
57
+ mlOrderId: string;
58
+ packId?: string;
59
+ buyerNickname?: string;
60
+ total: number;
61
+ currency: string;
62
+ paidAt?: number;
63
+ }
64
+ }
65
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -6,7 +6,8 @@ export declare enum NotificationTypeEnum {
6
6
  DOLARINFORMAL = "DOLARINFORMAL",
7
7
  DOLARBNA = "DOLARBNA",
8
8
  ERROR = "ERROR",
9
- AFIP_CERT_EXPIRY = "AFIP_CERT_EXPIRY"
9
+ AFIP_CERT_EXPIRY = "AFIP_CERT_EXPIRY",
10
+ MERCADOLIBRE = "MERCADOLIBRE"
10
11
  }
11
12
  declare global {
12
13
  interface NotificationInterface {
@@ -17,4 +17,7 @@ export var NotificationTypeEnum;
17
17
  NotificationTypeEnum["DOLARBNA"] = "DOLARBNA";
18
18
  NotificationTypeEnum["ERROR"] = "ERROR";
19
19
  NotificationTypeEnum["AFIP_CERT_EXPIRY"] = "AFIP_CERT_EXPIRY";
20
+ // ML order-ingestion fanout (app#797 / api#1574) — User-row read path
21
+ // added by the orders_v2 worker.
22
+ NotificationTypeEnum["MERCADOLIBRE"] = "MERCADOLIBRE";
20
23
  })(NotificationTypeEnum || (NotificationTypeEnum = {}));
package/dist/order.d.ts CHANGED
@@ -56,6 +56,42 @@ declare global {
56
56
  };
57
57
  };
58
58
  linkedPayments?: Record<string, LinkedPaymentEntry>;
59
+ channel?: OrderChannel;
60
+ mercadolibre?: OrderMercadolibre;
61
+ }
62
+ type OrderChannel = 'meli';
63
+ interface OrderMercadolibre {
64
+ mlOrderId: string;
65
+ packId?: string;
66
+ buyerNickname?: string;
67
+ shipmentId?: string;
68
+ logisticType?: string;
69
+ items?: OrderMercadolibreItem[];
70
+ fees?: {
71
+ saleFee?: number;
72
+ shippingCostSeller?: number;
73
+ currency: string;
74
+ currencyValue?: number;
75
+ currencyValueAt?: number;
76
+ };
77
+ billingInfo?: {
78
+ docType?: string;
79
+ docNumber?: string;
80
+ custType?: 'CO' | 'BU';
81
+ taxpayerType?: string;
82
+ iibbNumber?: string;
83
+ };
84
+ }
85
+ interface OrderMercadolibreItem {
86
+ mlItemId: string;
87
+ variationId?: string;
88
+ userProductId?: string;
89
+ sellerSku?: string;
90
+ quantity: number;
91
+ stock?: {
92
+ mlStoreId?: string;
93
+ networkNodeId?: string;
94
+ }[];
59
95
  }
60
96
  interface LinkedPaymentEntry {
61
97
  source: 'mp' | 'stripe' | 'mp_movement';
@@ -0,0 +1,21 @@
1
+ export interface PlatformConfigEntry {
2
+ key: string;
3
+ valueType: 'boolean' | 'string' | 'number';
4
+ kind: 'setting' | 'flag';
5
+ value: string | number | boolean;
6
+ defaultValue: string | number | boolean;
7
+ scope: 'app' | 'web' | 'landing' | 'storefront';
8
+ description?: string;
9
+ updatedBy?: string;
10
+ updatedAt?: number;
11
+ previousValue?: string | number | boolean;
12
+ source: 'default' | 'override';
13
+ }
14
+ export interface PlatformGlobalsPostBody {
15
+ globals: Record<string, {
16
+ value: string | number | boolean | null;
17
+ valueType: 'boolean' | 'string' | 'number';
18
+ kind: 'setting' | 'flag';
19
+ scope: 'app' | 'web' | 'landing' | 'storefront';
20
+ }>;
21
+ }
@@ -0,0 +1,5 @@
1
+ // Platform-wide config/feature-flag contracts (api#1108). Single fixed
2
+ // GLOBALS/PLATFORM scope, unlike Literals' multi-scope override chain — no
3
+ // per-tenant override use case identified for globals/flags (deliberate
4
+ // divergence from api#1484/#1485's Literals model).
5
+ export {};
package/dist/product.d.ts CHANGED
@@ -44,6 +44,19 @@ declare global {
44
44
  isService: boolean;
45
45
  cost: number;
46
46
  prices?: PriceSlot[];
47
+ channels?: Record<string, ProductChannelMapping>;
48
+ }
49
+ type ProductChannelStatus = 'linked' | 'pending' | 'paused' | 'rejected' | 'unlinked';
50
+ interface ProductChannelMapping {
51
+ externalId?: string;
52
+ userProductId?: string;
53
+ familyId?: string;
54
+ variationId?: string;
55
+ status: ProductChannelStatus;
56
+ linkedAt?: number;
57
+ lastSyncedAt?: number;
58
+ basis?: MlMatchBasis | 'manual';
59
+ syncErrors?: string[];
47
60
  }
48
61
  }
49
62
  export {};
package/dist/store.d.ts CHANGED
@@ -150,6 +150,7 @@ declare global {
150
150
  newPhotoURL?: string;
151
151
  removePhotoURL?: string;
152
152
  mercadopagoUserId?: string;
153
+ mercadolibreUserId?: string;
153
154
  currencies: StoreCurrencySubscription[];
154
155
  cashInMethods: Method[];
155
156
  cashOutMethods: Method[];
@@ -194,6 +195,7 @@ declare global {
194
195
  whatsapp?: WhatsAppConfig;
195
196
  sms?: SmsIntegration;
196
197
  gmail?: Gmail;
198
+ mercadolibre?: Mercadolibre;
197
199
  }
198
200
  interface SmsIntegration {
199
201
  /** When true, the store may send SMS through the shared platform account. */
@@ -265,6 +267,39 @@ declare global {
265
267
  code?: string;
266
268
  }
267
269
  type MercadopagoConnectionStatus = "connected" | "expired" | "disconnected" | "error" | "never";
270
+ type MercadolibreConnectionStatus = "connected" | "expired" | "disconnected" | "error" | "needs-reauth" | "never";
271
+ interface Mercadolibre {
272
+ userId?: string;
273
+ nickname?: string;
274
+ /** KMS-encrypted (`alias/ml-oauth-tokens`) — never returned in API responses. */
275
+ accessTokenEncrypted?: string;
276
+ /** KMS-encrypted. SINGLE-USE rotated by ML (last-only-valid) — never returned. */
277
+ refreshTokenEncrypted?: string;
278
+ expiresAt?: number;
279
+ connectedAt?: number;
280
+ tokenType?: string;
281
+ scope?: string;
282
+ status?: MercadolibreConnectionStatus;
283
+ disconnectedAt?: number;
284
+ lastTokenRefreshAt?: number;
285
+ /** Transient (network/5xx) failures only — a hard `invalid_grant` is
286
+ * terminal on FIRST occurrence (→ `needs-reauth`), never counted. */
287
+ tokenRefreshFailures?: number;
288
+ /** Write-ahead refresh-attempt marker (ADR-0018 Amendment B): unix ms
289
+ * persisted BEFORE calling ML's token endpoint. A dangling marker found
290
+ * by the next lock-acquirer means the previous winner may have burned
291
+ * the single-use refresh token → go straight to `needs-reauth`. */
292
+ refreshAttemptAt?: number;
293
+ /** Per-channel auto-invoice toggle — default OFF; enabling requires
294
+ * `defaultPosId` (dedicated PdV) + the Facturador-collision check. */
295
+ autoInvoice?: boolean;
296
+ defaultPosId?: number;
297
+ syncPolicy?: {
298
+ stockBuffer?: number;
299
+ stockLimit?: number;
300
+ paused?: boolean;
301
+ };
302
+ }
268
303
  interface Afip {
269
304
  production: boolean;
270
305
  address?: string;
@@ -286,6 +321,8 @@ declare global {
286
321
  accessTicket_EB?: string;
287
322
  accessTicket_RSF?: string;
288
323
  accessTicket_FEX?: string;
324
+ accessTicket_FECRED?: string;
325
+ accessTicket_CDC?: string;
289
326
  hasCert?: boolean;
290
327
  hasKey?: boolean;
291
328
  facturaMLegend?: 'retencion' | 'cbu_informada';
@@ -63,7 +63,7 @@ declare global {
63
63
  * every existing plan in `FEATURE_MATRIX` must then declare the new key
64
64
  * (TypeScript enforces this via `Record<FeatureKey, Entitlement>`).
65
65
  */
66
- type FeatureKey = 'maxOrdersMonth' | 'maxInvoicesMonth' | 'maxProducts' | 'maxUsers' | 'maxCustomers' | 'maxStores' | 'priceListsMax' | 'afipInvoicing' | 'paymentIntegrations' | 'suppliers' | 'cashManagement' | 'multiStore' | 'importExport' | 'advancedReports' | 'customBranding' | 'apiAccess' | 'prioritySupport' | 'whatsappCommerce' | 'aiFeatures' | 'mobileApp' | 'customDomain' | 'advancedPricing';
66
+ type FeatureKey = 'maxOrdersMonth' | 'maxInvoicesMonth' | 'maxProducts' | 'maxUsers' | 'maxCustomers' | 'maxStores' | 'priceListsMax' | 'afipInvoicing' | 'paymentIntegrations' | 'suppliers' | 'cashManagement' | 'multiStore' | 'importExport' | 'advancedReports' | 'customBranding' | 'apiAccess' | 'prioritySupport' | 'whatsappCommerce' | 'aiFeatures' | 'mobileApp' | 'customDomain' | 'advancedPricing' | 'marketplaceChannels';
67
67
  /** Full feature matrix — every tier declares every feature. */
68
68
  type FeatureMatrix = Record<PlanTier, Record<FeatureKey, Entitlement>>;
69
69
  /** Resolved entitlements for a specific tenant (matrix + overrides applied). */
@@ -60,6 +60,10 @@ declare global {
60
60
  invoiceNumber: number;
61
61
  dated: number;
62
62
  total: number;
63
+ authorizationCode: string;
64
+ authorizationMode?: 'CAE' | 'CAEA' | 'CAI';
65
+ receptorDocType?: number;
66
+ receptorDocNumber?: string;
63
67
  }
64
68
  /**
65
69
  * WSCDC `ConstatarComprobante` result (api#1500). `result` mirrors the
@@ -392,7 +392,7 @@ declare global {
392
392
  }
393
393
  interface IntegrationTokenRefreshedEvent extends UserActivityEventBase {
394
394
  event: 'Integration Token Refreshed';
395
- provider: 'mercadopago' | 'gmail';
395
+ provider: 'mercadopago' | 'gmail' | 'mercadolibre';
396
396
  outcome: 'refreshed' | 'disconnected' | 'skipped' | 'error';
397
397
  trigger: 'operator-single' | 'operator-global';
398
398
  detail?: string;
@@ -400,7 +400,15 @@ declare global {
400
400
  interface WaitlistConvertedEvent extends UserActivityEventBase {
401
401
  event: 'Waitlist Converted';
402
402
  }
403
- type UserActivityEvent = UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | TwoFactorEnrolledEvent | TwoFactorDisabledEvent | TwoFactorResetEvent | TwoFactorRecoveryCodesGeneratedEvent | StorePaletteChangedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent | UserCreatedEvent | UserUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | StockIncomeCreatedEvent | CategoryCreatedEvent | CategoryUpdatedEvent | BrandCreatedEvent | BrandUpdatedEvent | SupplierCreatedEvent | SupplierUpdatedEvent | SupplierInvoiceCreatedEvent | SupplierAccountCreatedEvent | SupplierAccountUpdatedEvent | AccountCreatedEvent | AccountDeletedEvent | BasketUpdatedEvent | BasketDeletedEvent | CashDrawerMovementEvent | PaymentCreatedEvent | PaymentLinkedEvent | PaymentUnlinkedEvent | PaymentLinkageUpdatedEvent | NotificationReadEvent | LogDeletedEvent | PlanCreatedEvent | StoreMaintenanceToggledEvent | PlatformMaintenanceToggledEvent | TenantCreatedEvent | LiteralUpdatedEvent | SupportTicketCreatedEvent | SupportTicketUpdatedEvent | AuditTrailViewedEvent | ReportViewedEvent | CustomerPiiViewedEvent | CashDrawerUiOpenedEvent | CashDrawerUiClosedEvent | ExportInitiatedEvent | ImpersonationUiStartedEvent | ImpersonationUiEndedEvent | PaymentViewedEvent | InvoiceViewedEvent | CustomerDetailViewedEvent | SupplierAccountViewedEvent | SearchPerformedEvent | ActionDeniedEvent | TwoFactorChallengeShownEvent | TwoFactorCodeValidationFailedEvent | TwoFactorEnrollmentStartedEvent | TwoFactorRecoveryCodesRevealedEvent | TwoFactorResetInitiatedEvent | IntegrationTokenRefreshedEvent | WaitlistConvertedEvent;
403
+ interface PlatformConfigUpdatedEvent extends UserActivityEventBase {
404
+ event: 'Platform Config Updated';
405
+ key: string;
406
+ kind: 'setting' | 'flag';
407
+ scope: 'app' | 'web' | 'landing' | 'storefront';
408
+ before: string | number | boolean;
409
+ after: string | number | boolean;
410
+ }
411
+ type UserActivityEvent = UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | TwoFactorEnrolledEvent | TwoFactorDisabledEvent | TwoFactorResetEvent | TwoFactorRecoveryCodesGeneratedEvent | StorePaletteChangedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent | UserCreatedEvent | UserUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | StockIncomeCreatedEvent | CategoryCreatedEvent | CategoryUpdatedEvent | BrandCreatedEvent | BrandUpdatedEvent | SupplierCreatedEvent | SupplierUpdatedEvent | SupplierInvoiceCreatedEvent | SupplierAccountCreatedEvent | SupplierAccountUpdatedEvent | AccountCreatedEvent | AccountDeletedEvent | BasketUpdatedEvent | BasketDeletedEvent | CashDrawerMovementEvent | PaymentCreatedEvent | PaymentLinkedEvent | PaymentUnlinkedEvent | PaymentLinkageUpdatedEvent | NotificationReadEvent | LogDeletedEvent | PlanCreatedEvent | StoreMaintenanceToggledEvent | PlatformMaintenanceToggledEvent | TenantCreatedEvent | LiteralUpdatedEvent | SupportTicketCreatedEvent | SupportTicketUpdatedEvent | AuditTrailViewedEvent | ReportViewedEvent | CustomerPiiViewedEvent | CashDrawerUiOpenedEvent | CashDrawerUiClosedEvent | ExportInitiatedEvent | ImpersonationUiStartedEvent | ImpersonationUiEndedEvent | PaymentViewedEvent | InvoiceViewedEvent | CustomerDetailViewedEvent | SupplierAccountViewedEvent | SearchPerformedEvent | ActionDeniedEvent | TwoFactorChallengeShownEvent | TwoFactorCodeValidationFailedEvent | TwoFactorEnrollmentStartedEvent | TwoFactorRecoveryCodesRevealedEvent | TwoFactorResetInitiatedEvent | IntegrationTokenRefreshedEvent | WaitlistConvertedEvent | PlatformConfigUpdatedEvent;
404
412
  }
405
413
  /**
406
414
  * Canonical whitelist of UI-only `UserActivityEvent` variant names — the 8
@@ -24,6 +24,7 @@
24
24
  // - 1.6.34 (+field) — LiteralUpdatedEvent gains `scope`; new `LiteralScope` contract (api#1484)
25
25
  // - (+1 variant) — IntegrationTokenRefreshedEvent (types#91, api#1540)
26
26
  // - 1.6.39 (+1 variant) — WaitlistConvertedEvent (types#92, api#1567)
27
+ // - 1.6.43 (+1 variant) — PlatformConfigUpdatedEvent (api#1108)
27
28
  /**
28
29
  * Canonical whitelist of UI-only `UserActivityEvent` variant names — the 8
29
30
  * Phase 3 verbs shipped in 1.6.13 (types#74). Imported by the api side
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.6.42",
3
+ "version": "1.6.44",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",