@stackin-io/stackin-node-sdk 0.19.0 → 0.21.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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  Node/TypeScript SDK for fiscal document issuance — a handful of business fields, nothing about certificates, XML, XSD, signing or SOAP. The API resolves all of that from the issuer's own configuration, identified by `apiKey`.
20
20
 
21
- **One class, `Invoice`** — `issue()`/`consult()`/`cancel()`/`reissue()`/`correct()`/`invalidate()`/`pdf()`/`received()`/`manifest()`, nothing else to instantiate. Each line item is a `br.Product` — `description`/`amount` are universal, everything else (`ncm`/`cfop`/`cest`/tax groups...) is Brazil-specific and only required for NFE; NFSE ignores it.
21
+ **One class, `Invoice`** — `issue()`/`consult()`/`cancel()`/`reissue()`/`correct()`/`invalidate()`/`pdf()`/`history()`/`received()`/`syncReceived()`/`manifest()`/`usage()`, nothing else to instantiate. Each line item is a `br.Product` — `description`/`amount` are universal, everything else (`ncm`/`cfop`/`cest`/tax groups...) is Brazil-specific and only required for NFE; NFSE ignores it.
22
22
 
23
23
  ## What a line item is worth
24
24
 
@@ -83,8 +83,8 @@ await client.cancel("ACCESS_KEY...", {
83
83
  reason: "Typo",
84
84
  });
85
85
 
86
- // The authorizer's PDF, as bytes. NFS-e only; the XML stays the legally valid
87
- // document, and a 502 here means the authorizer is down.
86
+ // The PDF, as bytes, for either document type: the API draws the DANFE for an
87
+ // NF-e and the DANFSe for an NFS-e itself. The XML stays the legally valid document.
88
88
  const document = await client.pdf("ACCESS_KEY...", {
89
89
  documentType: DocumentType.NFSE,
90
90
  });
@@ -178,6 +178,7 @@ await client.issue({
178
178
  | `referencedKeys` | `referenced_keys` | Access keys of the NF-e, NFC-e or CF-e this one refers to. Required for `COMPLEMENTARY` (exactly one) and, but for a few CFOPs, for `RETURN`. NF-e only. |
179
179
  | `foreignId` | `foreign_id` | The passport or other document of a buyer abroad, 5 to 20 letters, digits or `:.+-/()`. May be left out. |
180
180
  | `export` | `export` | `{ exitState, place, dispatchPlace? }`: the Brazilian state and place the goods leave from, and the customs facility. Required on an outgoing NF-e abroad. |
181
+ | `contingency` | `contingency` | NF-e only: `true` sends the document through the UF's contingency authorizer (SVC-AN or SVC-RS, `tpEmis` 6/7) for when its own is down. Sent only when `true`. |
181
182
 
182
183
  A buyer abroad is `recipientAddress.state` = `"EX"`, NF-e only. There `taxId` is left out (the API refuses one, rejection 720), `zipCode` and `cityCode` may be left out (the API writes `9999999` / EXTERIOR), and `countryCode` — the BACEN country code, 1 to 4 digits, anything but 1058 — is required in their place, beside an optional `countryName`. The SDK does not check the BACEN code's check digit: the official table has countries whose digit does not close. Everywhere else `taxId` and `zipCode` stay required, and a missing one is a `ValidationError` before the request.
183
184
 
@@ -330,14 +331,66 @@ round trip — and the authorizer checks again for what we can't see from here.
330
331
 
331
332
  **NF-e only**, and it takes no access key: there is no document to point at.
332
333
 
334
+ Ranges already reported are listed, a page at a time, with the SEFAZ `status` and
335
+ `protocol` of each — read it before reporting the same range twice:
336
+
337
+ ```ts
338
+ const page = await invoice.invalidations({ limit: 20 });
339
+ ```
340
+
341
+ ## Before the first document, and after a refusal
342
+
343
+ ```ts
344
+ const ready = await client.readiness(); // GET /company
345
+ if (!ready.ready) {
346
+ console.log(ready.missing); // certificate, certificate_expired, certificate_unreadable, address
347
+ }
348
+
349
+ const why = await client.rejection(invoiceId); // a rejected document, by its local id
350
+ console.log(why.code, why.explanation, why.steps, why.suggested);
351
+
352
+ const stats = await client.stats({ days: 7 }); // totals, by type and status, this week against the last
353
+ ```
354
+
355
+ `readiness()` says whether the company can issue right now and, when it cannot,
356
+ what is missing, plus the certificate's expiry, the tax regime (CRT) and the
357
+ default série per document type. `rejection()` reads the authorizer's answer
358
+ (`submissions()` has it raw) in plain words, with the field to fix and, when there
359
+ is one, a suggested value; a document that is not rejected is an `APIError` 409.
360
+ `stats()` takes `days` from 1 to 365 (the API's default 30), checked locally.
361
+
362
+ ## Suggesting a classification
363
+
364
+ ```ts
365
+ const suggestion = await client.classify({
366
+ description: "Cerveja artesanal IPA 500ml",
367
+ documentType: DocumentType.NFE,
368
+ recipientState: "SP",
369
+ answers: { purpose: "resale" }, // optional, from missing_information
370
+ });
371
+ const best = suggestion.primary_candidate; // ncm, cfop, cst/csosn, cest, confidence
372
+ ```
373
+
374
+ **A suggestion, never a decision.** Every code in a candidate is read from the
375
+ published tables, but the NCM and CFOP decide the tax owed: show it, have someone
376
+ confirm it, and only then put it on an item. `missing_information` lists what
377
+ would settle it; answer through `answers` and ask again. `description` is 3 to
378
+ 500 characters, checked locally.
379
+
333
380
  ## Documents issued against you
334
381
 
335
382
  Everything above serves the **issuer**. These two serve the **recipient**: what
336
383
  suppliers billed to this CNPJ, and the formal answer to it.
337
384
 
338
- Reading the list never calls the SEFAZ. The authorizer caps how many times a CNPJ
339
- may ask for its distribution per day, so collecting runs on a schedule on the API
340
- side and a page refresh cannot spend that allowance.
385
+ Reading the list never calls the SEFAZ. The API collects on a schedule, every six
386
+ hours, and `syncReceived()` asks it to collect now. After a read that finds
387
+ nothing more, the SEFAZ makes the CNPJ wait one hour before asking again; a sync
388
+ inside that wait is refused with a `RateLimitedError` (429, `code`
389
+ `DISTRIBUTION_COOLDOWN`) whose `retryAt` and `retryAfter` say when to come back.
390
+
391
+ The first 50 received documents a month are included in every plan; each one
392
+ after that takes R$ 0,05 from the account credit. Some existing accounts are
393
+ exempt, and `usage().received_free` says whether yours is.
341
394
 
342
395
  ```typescript
343
396
  import { Manifestation } from "@stackin-io/stackin-node-sdk";
@@ -345,6 +398,9 @@ import { Manifestation } from "@stackin-io/stackin-node-sdk";
345
398
  const page = await client.received({ limit: 20 });
346
399
  console.log(page.total);
347
400
 
401
+ const sync = await client.syncReceived();
402
+ console.log(sync.stored, sync.next_sync_at);
403
+
348
404
  await client.manifest(accessKey, { manifestation: Manifestation.CIENCIA });
349
405
  await client.manifest(accessKey, {
350
406
  manifestation: Manifestation.OPERACAO_NAO_REALIZADA,
@@ -383,6 +439,12 @@ await new Taxpayer({ apiKey: "..." }).get("00000000000191");
383
439
 
384
440
  `cfop`, `ncm`, `cest`, `cst`, `csosn`, `issService`, `icmsFuel` and `ibsCbsClass` have accessors. **`kind(name)` reaches anything else**, including a classification published after this release — ask `kinds()` rather than trusting this list.
385
441
 
442
+ `cities(name, { state })` lists the municipalities whose name starts with `name`, at most 20, each with its IBGE `code` — issuing resolves `cityCode` by itself, so this is for a name that matches more than one:
443
+
444
+ ```ts
445
+ await ref.cities("santa rita", { state: "SP" }); // [{ country: "BR", code: "...", name: "...", state: "SP" }]
446
+ ```
447
+
386
448
  `metadata` comes back as the API sends it and differs per kind: `utrib` on an NCM, `ncm_code` on a CEST, `tax_type` on a CST, `null` on an ISS service.
387
449
 
388
450
  Three things worth knowing before you loop:
@@ -436,6 +498,56 @@ await new Invoice({ apiKey: "..." }).issue({
436
498
  - `updateClient: true` on `issue()` rewrites an existing client with that request's recipient data. Left out, the issuance only counts one more use of it.
437
499
  - Reading needs `invoice:read`; creating, editing and deactivating need `invoice:issue`. `company` works here as on `Invoice`, on the client or per call.
438
500
 
501
+ ## What you issued, and what it cost
502
+
503
+ `history()` lists what the company issued, newest first. Besides `documentType`,
504
+ `status`, `limit`/`offset` and `sortBy`/`orderBy`, it takes `externalReference`,
505
+ an exact match on the id you sent at issuance, and `fields: "summary"`, a lighter
506
+ item per invoice.
507
+
508
+ ```ts
509
+ const page = await client.history({ externalReference: "PED-42", fields: "summary" });
510
+
511
+ const usage = await client.usage();
512
+ console.log(usage.plan_name, usage.used_invoices, usage.included_invoices);
513
+ console.log(usage.used_received, usage.included_received, usage.received_free);
514
+ console.log(usage.credit_balance); // cents
515
+ ```
516
+
517
+ `usage()` (`GET /company/usage`) returns the plan and the current period's
518
+ consumption: `plan_name`, `plan_slug`, `included_invoices`, `used_invoices`,
519
+ `overage_price_cents` (null when the plan has none), `included_received`,
520
+ `used_received`, `received_price_cents`, `received_free`,
521
+ `current_period_start`, `current_period_end` (ISO 8601, the end may be null),
522
+ `credit_balance` and `companies_on_account`. Amounts are in cents. Fields the API
523
+ adds later come through as they are.
524
+
525
+ ## Webhooks
526
+
527
+ `Webhooks` registers where the company's events are delivered: `invoice.authorized`,
528
+ `invoice.rejected`, `invoice.cancelled` and `invoice.corrected` (`WEBHOOK_EVENTS`).
529
+ An endpoint receives the events of the credential's own environment only.
530
+
531
+ ```ts
532
+ import { Webhooks } from "@stackin-io/stackin-node-sdk";
533
+
534
+ const hooks = new Webhooks({ apiKey: "..." });
535
+
536
+ const endpoint = await hooks.create({
537
+ url: "https://shop.example/stackin",
538
+ secret: process.env.STACKIN_WEBHOOK_SECRET!, // 16 to 255 characters
539
+ events: ["invoice.authorized", "invoice.rejected"], // left out: every event
540
+ });
541
+ await hooks.list(); // a plain list; secrets are never returned
542
+ await hooks.deliveries({ limit: 20 }); // every attempt: status, attempts, last_error
543
+ await hooks.delete(String(endpoint.id)); // stops delivery, keeps the history
544
+ ```
545
+
546
+ The secret signs every delivery and is not returned again, so keep it. An `https://`
547
+ URL, the secret's length and the event names are checked locally; the API also
548
+ refuses a URL that points at a private network. On an OAuth credential every call
549
+ needs `webhook:manage`. `company` works here as on `Invoice`, on the client or per call.
550
+
439
551
  ## One credential, several companies
440
552
 
441
553
  An API key is one company and needs nothing here. A credential that covers several companies (an OAuth connection) has to say which one each call acts on, by company id (UUID) or CNPJ — punctuation is ignored. Set it on the client, or per call; the call's wins. It goes out as the `X-Stackin-Company` header, on every request, lookups included. Unset, no header is sent and the request is exactly what it was before.
@@ -465,8 +577,12 @@ await client.consult("ACCESS_KEY...", {
465
577
 
466
578
  All three extend `APIError` and are never retried: the answer would not change.
467
579
  - `ClientAlreadyExistsError` (409, an `APIError`) — `Clients.create()` or `update()` with a `taxId` or `foreignId` the company already has on another client. `clientId` names that client.
580
+ - `ClientInactiveError` (422, an `APIError`) — `issue()` with the `clientId` of a deactivated client. `clientId` names it; reactivate it first.
581
+ - `ClientNotFoundError` (404, an `APIError`) — a `clientId` the company has no client for. `clientId` names it.
582
+ - `PaymentRequiredError` (402, an `APIError`) — the account's plan or credit does not cover the call; `detail` says why.
583
+ - `RateLimitedError` (429, an `APIError`) — the call came too soon. `retryAfter` is the `Retry-After` header in seconds, `retryAt` the moment the body names and `code` the reason (`DISTRIBUTION_COOLDOWN` for `syncReceived()` inside the SEFAZ one-hour wait); each is undefined when the response does not carry it.
468
584
  - `ConnectionFailedError` — the API didn't respond (network/DNS/timeout).
469
- - `ValidationError` — `issue()` without `clientName` or `taxId` and no `clientId` (`taxId` may be left out for an NF-e to a buyer abroad), `items` is empty, missing `ncm`/`cfop` on an item for NFE, a missing/incomplete `recipientAddress` on NFE, an NFE item `description` over 120 characters, NFE text the NF-e cannot carry (outside ISO-8859-1, other than the typographic characters the API converts), a missing/incomplete `recipientAddress` on an NFSE with a `taxRetained` item, or a `correct()` access key that is not an NF-e access key (44 characters). Building a `Product` with a malformed `ncm`, `barcode` or `recopiNumber`, or an `Address` with a `street`/`neighborhood` under 2 characters, raises it too.
585
+ - `ValidationError` — `issue()` without `clientName` or `taxId` and no `clientId` (`taxId` may be left out for an NF-e to a buyer abroad), `items` is empty, missing `ncm`/`cfop` on an item for NFE, a missing/incomplete `recipientAddress` on NFE, an NFE item `description` over 120 characters, NFE text the NF-e cannot carry (outside ISO-8859-1, other than the typographic characters the API converts), a missing/incomplete `recipientAddress` on an NFSE with a `taxRetained` item, or a `correct()` access key that is not an NF-e access key (44 characters). Also `stats()` with `days` outside 1–365, `classify()` with a `description` outside 3–500 characters or a `recipientState` that is not two letters, `FiscalReference.cities()` with a `name` outside 2–100 characters, `Webhooks.create()` with a URL that is not `https://`, a secret outside 16–255 characters or an event name not in `WEBHOOK_EVENTS`, and an empty, `.` or `..` id where it becomes a path segment (`rejection()`, `submissions()`, `Webhooks.delete()`). Building a `Product` with a malformed `ncm`, `barcode` or `recopiNumber`, or an `Address` with a `street`/`neighborhood` under 2 characters, raises it too.
470
586
 
471
587
  Building the full fiscal document (issuer data, service code, tax groups, schema-accurate XML) is the API's job — configured once per company, not passed on every call.
472
588
 
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Address } from "./address";
2
2
  import { Product } from "./br/product";
3
- import { AuthorizedCompanies, Direction, DocumentType, Environment, Manifestation, Purpose } from "./types";
3
+ import { AuthorizedCompanies, Direction, DocumentType, Environment, Manifestation, Purpose, ReceivedSync, Usage } from "./types";
4
4
  export declare const DEFAULT_BASE_URL = "https://sdk.stackin.io";
5
5
  export declare const COMPANY_HEADER = "X-Stackin-Company";
6
6
  export interface ClientOptions {
@@ -106,12 +106,41 @@ export interface IssueRequest {
106
106
  * data; left out, its use is only counted. Sent only when true.
107
107
  */
108
108
  updateClient?: boolean;
109
+ /**
110
+ * NF-e only: true sends the document through the UF's contingency
111
+ * authorizer (SVC-AN or SVC-RS, tpEmis 6/7) for when its own is down.
112
+ * Sent only when true.
113
+ */
114
+ contingency?: boolean;
109
115
  }
110
116
  /** Per-call company selection, overriding the client's. */
111
117
  export interface CompanyOption {
112
118
  /** The company id (UUID) or CNPJ, sent as X-Stackin-Company. */
113
119
  company?: string;
114
120
  }
121
+ /** A page of a listing, as the API paginates it. Every field optional. */
122
+ export interface PageQuery extends CompanyOption {
123
+ limit?: number;
124
+ offset?: number;
125
+ sortBy?: string;
126
+ orderBy?: string;
127
+ }
128
+ /** One item's description to classify, and the context that changes its codes. */
129
+ export interface ClassifyRequest extends CompanyOption {
130
+ /** 3 to 500 characters. */
131
+ description: string;
132
+ documentType: DocumentType;
133
+ /** The recipient's two-letter UF; it decides the CFOP. */
134
+ recipientState?: string;
135
+ /**
136
+ * Answers to the suggestion's missing_information, by key:
137
+ * operation_scope, purpose, contains_alcohol, service_city_code,
138
+ * tax_retained. Left out when empty.
139
+ */
140
+ answers?: Record<string, unknown>;
141
+ }
142
+ /** The API's pagination query, leaving out what was not passed. */
143
+ export declare function pageQuery(options: PageQuery): Record<string, string>;
115
144
  interface RequestOptions {
116
145
  body?: unknown;
117
146
  query?: Record<string, string>;
@@ -134,6 +163,8 @@ export declare class Client {
134
163
  constructor(options?: ClientOptions);
135
164
  protected headers(idempotencyKey?: string, company?: string): Record<string, string>;
136
165
  protected request(method: string, path: string, opts?: RequestOptions): Promise<Record<string, unknown>>;
166
+ /** A call whose answer is a bare JSON array; an empty body is []. */
167
+ protected requestList<T = Record<string, unknown>>(method: string, path: string, opts?: RequestOptions): Promise<T[]>;
137
168
  protected send(method: string, path: string, opts?: RequestOptions): Promise<Response>;
138
169
  }
139
170
  export declare class Invoice extends Client {
@@ -182,22 +213,42 @@ export declare class Invoice extends Client {
182
213
  * Documents other companies issued against this one.
183
214
  *
184
215
  * Reads what the API already collected; it does not call the
185
- * authorizer. Collecting runs on a schedule there, because the SEFAZ
186
- * caps how many times a CNPJ may ask per day.
216
+ * authorizer. The API collects every six hours, and syncReceived()
217
+ * asks it to collect now. The first 50 received documents a month
218
+ * are included in every plan; each one after that takes R$ 0,05 from
219
+ * the account credit, unless usage().received_free says the account
220
+ * is exempt.
187
221
  */
188
222
  received(options?: {
189
223
  limit?: number;
190
224
  offset?: number;
191
225
  } & CompanyOption): Promise<Record<string, unknown>>;
226
+ /**
227
+ * Collects the documents issued against this company from the SEFAZ
228
+ * now, instead of waiting for the six-hour schedule.
229
+ *
230
+ * After a read that finds nothing more, the SEFAZ makes the CNPJ
231
+ * wait one hour before asking again. Inside that wait the API answers
232
+ * 429 DISTRIBUTION_COOLDOWN, raised as a RateLimitedError whose
233
+ * retryAt and retryAfter say when to come back. next_sync_at on the
234
+ * result says the same after a successful call. Documents past the
235
+ * 50 a month included take R$ 0,05 each from the account credit.
236
+ */
237
+ syncReceived(options?: CompanyOption): Promise<ReceivedSync>;
192
238
  /**
193
239
  * What this company issued, newest first.
194
240
  *
195
241
  * The counterpart of received(): that one lists what was issued
196
242
  * against the company, this one what the company issued.
243
+ *
244
+ * externalReference matches the caller's own id exactly. fields
245
+ * "summary" answers a lighter item per invoice.
197
246
  */
198
247
  history(options?: {
199
248
  documentType?: DocumentType;
200
249
  status?: string;
250
+ externalReference?: string;
251
+ fields?: "summary";
201
252
  limit?: number;
202
253
  offset?: number;
203
254
  sortBy?: string;
@@ -215,13 +266,12 @@ export declare class Invoice extends Client {
215
266
  reason?: string;
216
267
  } & CompanyOption): Promise<Record<string, unknown>>;
217
268
  /**
218
- * The authorizer's own rendering of an authorized document, as raw
219
- * bytes — the only method that does not return a parsed object.
269
+ * The printable rendering of an authorized document, as raw bytes —
270
+ * the only method that does not return a parsed object.
220
271
  *
221
- * The XML is the legally valid document; this is a convenience, and
222
- * the authorizer's endpoint for it is unstable, so an APIError with
223
- * status 502 means the authorizer is unavailable, not that the
224
- * invoice is wrong. NFS-e only.
272
+ * The API draws it itself from the authorized XML: the DANFE for an
273
+ * NF-e, the DANFSe for an NFS-e. The XML stays the legally valid
274
+ * document; the PDF is its representation.
225
275
  */
226
276
  pdf(accessKey: string, options: {
227
277
  documentType: DocumentType;
@@ -234,6 +284,56 @@ export declare class Invoice extends Client {
234
284
  * has no access key to look it up by.
235
285
  */
236
286
  submissions(invoiceId: string, options?: CompanyOption): Promise<Array<Record<string, unknown>>>;
287
+ /**
288
+ * Why a rejected document was refused, and what to change.
289
+ *
290
+ * submissions() has the authorizer's own answer; this reads it for
291
+ * someone who does not speak SEFAZ: code, message, explanation,
292
+ * steps, the field to fix and, when there is one, a suggested value.
293
+ * Takes the invoiceId, like submissions(). A document that is not
294
+ * rejected is an APIError 409.
295
+ */
296
+ rejection(invoiceId: string, options?: CompanyOption): Promise<Record<string, unknown>>;
297
+ /**
298
+ * A suggested fiscal classification for one item's description.
299
+ *
300
+ * A suggestion, never a decision: primary_candidate and
301
+ * alternative_candidates carry the NCM, CFOP, CST/CSOSN, CEST or
302
+ * service code, each read from the published tables, with a
303
+ * confidence, and missing_information lists what would settle it
304
+ * (pass those back in answers). Someone confirms it before it goes on
305
+ * an item; the codes decide the tax owed.
306
+ */
307
+ classify(request: ClassifyRequest): Promise<Record<string, unknown>>;
308
+ /**
309
+ * Counts of this company's documents, and the last days of them.
310
+ *
311
+ * total, by_document_type and by_status cover every document;
312
+ * current_period/previous_period compare the last days (1 to 365, the
313
+ * API's default 30) with the ones before, and daily_series has one
314
+ * row per day.
315
+ */
316
+ stats(options?: {
317
+ days?: number;
318
+ } & CompanyOption): Promise<Record<string, unknown>>;
319
+ /**
320
+ * Whether the company can issue right now, and if not, why.
321
+ *
322
+ * ready is false with missing naming the cause: certificate,
323
+ * certificate_expired, certificate_unreadable or address. Also
324
+ * certificate_expires_at, tax_regime (CRT), state and the
325
+ * default_series per document type. Ask before a first document
326
+ * instead of failing it.
327
+ */
328
+ readiness(options?: CompanyOption): Promise<Record<string, unknown>>;
329
+ /**
330
+ * The numbering ranges this company already invalidated, a page.
331
+ *
332
+ * Each row carries the range, the reason, the SEFAZ status and its
333
+ * protocol. Read it before invalidate() to avoid reporting the same
334
+ * range twice.
335
+ */
336
+ invalidations(options?: PageQuery): Promise<Record<string, unknown>>;
237
337
  /**
238
338
  * Which companies this credential reaches, and with what permissions,
239
339
  * in the environment it belongs to.
@@ -243,6 +343,16 @@ export declare class Invoice extends Client {
243
343
  * every permission, and lists as such.
244
344
  */
245
345
  companies(): Promise<AuthorizedCompanies>;
346
+ /**
347
+ * The company's plan and what it has used in the current period:
348
+ * issued and received documents against what the plan includes, the
349
+ * prices past that, and the account credit, all in cents.
350
+ *
351
+ * Fields the API adds later come through as they are. An API that
352
+ * predates received-invoice billing leaves the received_* fields out;
353
+ * they default to 50 included, 0 used, 5 cents each and not exempt.
354
+ */
355
+ usage(options?: CompanyOption): Promise<Usage>;
246
356
  }
247
357
  export {};
248
358
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAiB,OAAO,EAAE,MAAM,cAAc,CAA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