@flintpay/node 0.3.0-beta.1 → 0.4.0-beta.1

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/RUNTIME.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Flint Public API runtime guide (node)
2
2
 
3
- Package 0.3.0-beta.1; API 2026-09-07.
3
+ Package 0.4.0-beta.1; API 2026-09-07.
4
4
 
5
5
  [Back to the quickstart](README.md) · [API reference](REFERENCE.md)
6
6
 
@@ -49,7 +49,7 @@ Portable digit/word pattern escapes retain their ASCII ECMAScript meaning in bot
49
49
 
50
50
  ## Retries and idempotency
51
51
 
52
- Retries count total attempts, include jitter and Retry-After, and never exceed the declared policy. Persist an idempotency key across process restarts and submissions within the server's documented retention/scope. Automatic keys cover one SDK call only. Explicit keys from operation inputs, request headers or idempotencyKey are preserved; conflicting values fail before dispatch. A timeout after dispatch can leave the remote outcome unknown; inspect SdkError.outcome. Disable nested transport/application retries to avoid multiplied attempts. 409/412 are distinct conflicts and never automatically overwritten.
52
+ Retries count total attempts, include jitter and Retry-After, and never exceed the declared policy. Persist an idempotency key across process restarts and submissions within the server's documented retention/scope. Automatic keys cover one SDK call only and can satisfy required idempotency headers; generated keys must pass the declared header validation. Explicit keys from operation inputs, request headers or idempotencyKey are preserved; conflicting values fail before dispatch. A timeout after dispatch can leave the remote outcome unknown; inspect SdkError.outcome. Disable nested transport/application retries to avoid multiplied attempts. 409/412 are distinct conflicts and never automatically overwritten.
53
53
 
54
54
  ## Timeouts, streaming and cancellation
55
55
 
@@ -63,7 +63,7 @@ Pagination is lazy, supports maxPages/maxItems, and does not guarantee a stable
63
63
 
64
64
  ## Destinations and API versions
65
65
 
66
- Explicit allowedOrigins govern all destinations, including pagination. HTTPS is required unless allowInsecureHttp is set for local tests. Declared 302/307 responses return Location metadata without following redirects; undeclared redirects are rejected. Authentication is attached only after destination validation. API version headers are pinned when configured; changing them does not update generated types.
66
+ Explicit allowedOrigins govern all destinations, including pagination. HTTPS is required unless allowInsecureHttp is set for local tests. Declared 302/307 responses return Location metadata without following redirects; undeclared redirects are rejected. Authentication is attached only after destination validation. API version headers are pinned when configured; changing them does not update generated types. Required version headers are supplied by the pin. Required conditional headers may be supplied through ifMatch or request headers without duplicating them in the input. Effective managed header values are validated before dispatch.
67
67
 
68
68
  ## Client lifecycle and transports
69
69
 
package/codec-plan.js CHANGED
@@ -66,13 +66,16 @@ export function directionalSchema(schema, response) {
66
66
  collect(schema);
67
67
  if (!omitted.size)
68
68
  return schema;
69
+ // A directional field cannot satisfy a predicate in the opposite direction.
70
+ // Keep predicates intact so its absence makes the condition false; applied
71
+ // constraints still omit directionally unavailable required fields.
69
72
  const project = (s) => ({
70
73
  ...s,
71
74
  ...(s.required ? { required: s.required.filter((key) => !omitted.has(key)) } : {}),
72
75
  ...(s.allOf ? { allOf: s.allOf.map(project) } : {}),
73
76
  ...(s.anyOf ? { anyOf: s.anyOf.map(project) } : {}),
74
77
  ...(s.oneOf ? { oneOf: s.oneOf.map(project) } : {}),
75
- ...(s.if ? { if: project(s.if) } : {}),
78
+ ...(s.if ? { if: s.if } : {}),
76
79
  ...(s.then ? { then: project(s.then) } : {}),
77
80
  ...(s.else ? { else: project(s.else) } : {}),
78
81
  });
@@ -0,0 +1,18 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ // Reuse this key when retrying the same action.
7
+ const idempotencyKey = crypto.randomUUID();
8
+
9
+ const result = await client.creditNotes.createRefund(
10
+ "example",
11
+ {
12
+ reason: "duplicate",
13
+ "Idempotency-Key": idempotencyKey,
14
+ },
15
+ { maxAttempts: 1 },
16
+ );
17
+ console.log(result.refund_id);
18
+ console.log(result.status);
@@ -0,0 +1,18 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ // Reuse this key when retrying the same action.
7
+ const idempotencyKey = crypto.randomUUID();
8
+
9
+ const result = await client.creditNotes.createRefund(
10
+ "example",
11
+ {
12
+ reason: "duplicate",
13
+ "Idempotency-Key": idempotencyKey,
14
+ },
15
+ { maxAttempts: 1 },
16
+ );
17
+ console.log(result.refund_id);
18
+ console.log(result.status);
@@ -0,0 +1,10 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ const result = await client.creditNotes.listRefunds(
7
+ "example",
8
+ {},
9
+ { maxAttempts: 1 },
10
+ );
@@ -0,0 +1,10 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ const result = await client.creditNotes.listRefunds(
7
+ "example",
8
+ {},
9
+ { maxAttempts: 1 },
10
+ );
@@ -7,5 +7,4 @@ const result = await client.developer.getAuthContext(
7
7
  {},
8
8
  { maxAttempts: 1 },
9
9
  );
10
- console.log(result.api_key_id);
11
10
  console.log(result.merchant_id);
@@ -7,5 +7,4 @@ const result = await client.developer.getAuthContext(
7
7
  {},
8
8
  { maxAttempts: 1 },
9
9
  );
10
- console.log(result.api_key_id);
11
10
  console.log(result.merchant_id);
@@ -0,0 +1,17 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ // Reuse this key when retrying the same action.
7
+ const idempotencyKey = crypto.randomUUID();
8
+
9
+ const result = await client.invoices.assessLateFee(
10
+ "example",
11
+ {
12
+ "Idempotency-Key": idempotencyKey,
13
+ },
14
+ { maxAttempts: 1 },
15
+ );
16
+ console.log(result.invoice_id);
17
+ console.log(result.merchant_id);
@@ -0,0 +1,17 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ // Reuse this key when retrying the same action.
7
+ const idempotencyKey = crypto.randomUUID();
8
+
9
+ const result = await client.invoices.assessLateFee(
10
+ "example",
11
+ {
12
+ "Idempotency-Key": idempotencyKey,
13
+ },
14
+ { maxAttempts: 1 },
15
+ );
16
+ console.log(result.invoice_id);
17
+ console.log(result.merchant_id);
@@ -0,0 +1,19 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ // Reuse this key when retrying the same action.
7
+ const idempotencyKey = crypto.randomUUID();
8
+
9
+ const result = await client.invoices.waiveLateFee(
10
+ "example",
11
+ "example",
12
+ {
13
+ reason: "example",
14
+ "Idempotency-Key": idempotencyKey,
15
+ },
16
+ { maxAttempts: 1 },
17
+ );
18
+ console.log(result.invoice_id);
19
+ console.log(result.merchant_id);
@@ -0,0 +1,19 @@
1
+ import { Client } from '@flintpay/node';
2
+ const client = new Client({
3
+ baseUrl: process.env.API_BASE_URL ?? 'https://sandbox.example.invalid',
4
+ apiKey: process.env.API_KEY ?? '',
5
+ });
6
+ // Reuse this key when retrying the same action.
7
+ const idempotencyKey = crypto.randomUUID();
8
+
9
+ const result = await client.invoices.waiveLateFee(
10
+ "example",
11
+ "example",
12
+ {
13
+ reason: "example",
14
+ "Idempotency-Key": idempotencyKey,
15
+ },
16
+ { maxAttempts: 1 },
17
+ );
18
+ console.log(result.invoice_id);
19
+ console.log(result.merchant_id);
@@ -10,5 +10,3 @@ const result = await client.oauth.exchangePartnerInstallToken(
10
10
  },
11
11
  { maxAttempts: 1 },
12
12
  );
13
- console.log(result.environment_grant_id);
14
- console.log(result.merchant_id);
@@ -10,5 +10,3 @@ const result = await client.oauth.exchangePartnerInstallToken(
10
10
  },
11
11
  { maxAttempts: 1 },
12
12
  );
13
- console.log(result.environment_grant_id);
14
- console.log(result.merchant_id);
@@ -1,4 +1,4 @@
1
- <!-- Package 0.3.0-beta.1; API 2026-09-07 -->
1
+ <!-- Package 0.4.0-beta.1; API 2026-09-07 -->
2
2
 
3
3
  # Pagination and retries
4
4
 
@@ -40,7 +40,7 @@ Pagination can make multiple requests to fetch distinct pages; it does not autom
40
40
 
41
41
  ## Persist keys before writes
42
42
 
43
- Every write that declares `Idempotency-Key` in the pinned API contract supports `idempotencyKey` through request options (278 operations). Required-key endpoints accept the key here without duplicating it in the input; they still reject a missing key before dispatch. Supplying a key does not enable automatic retries. Pass `idempotencyKey` in request options, or the identical `Idempotency-Key` input/header. The SDK sends the supplied key and rejects conflicting key sources. Automatic key generation is disabled.
43
+ Every write that declares `Idempotency-Key` in the pinned API contract supports `idempotencyKey` through request options (281 operations). Required-key endpoints accept the key here without duplicating it in the input; they still reject a missing key before dispatch. Supplying a key does not enable automatic retries. Pass `idempotencyKey` in request options, or the identical `Idempotency-Key` input/header. The SDK sends the supplied key and rejects conflicting key sources. Automatic key generation is disabled.
44
44
 
45
45
  Create and persist a key when your application decides on the business action. Reuse that saved key and the identical input when resuming after a crash or timeout. A different action or changed request needs a new key. Replay lifetime and semantics follow the endpoint contract. The general window is 24 hours; inventory command keys persist for at least as long as their inventory effects, and merchant account sessions mint fresh secrets on repeated success. Follow each endpoint's documented scope and retention. If the final outcome is unknown, reconcile the action before resubmitting. A deliberate retry must reuse the persisted key and identical request body.
46
46