@stewardhq/sdk 0.3.0 → 0.6.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.
Files changed (41) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +332 -273
  3. package/dist/_chunks/errors.js +1 -1
  4. package/dist/_chunks/events.d.ts +386 -78
  5. package/dist/_chunks/events.js +1035 -19
  6. package/dist/_chunks/index.d.ts +3752 -305
  7. package/dist/_chunks/locale.d.ts +270 -2
  8. package/dist/_chunks/src.js +925 -31
  9. package/dist/_chunks/validators.d.ts +46 -2
  10. package/dist/_chunks/validators.js +128 -27
  11. package/dist/_chunks/webhook-core.d.ts +2 -2
  12. package/dist/contract.d.ts +4 -4
  13. package/dist/contract.js +4 -4
  14. package/dist/index.d.ts +447 -33
  15. package/dist/index.js +1659 -26
  16. package/dist/server.d.ts +66 -16
  17. package/dist/server.js +35 -4
  18. package/package.json +14 -13
  19. package/dist/_chunks/steward.d.ts +0 -189
  20. package/dist/_chunks/steward.js +0 -564
  21. package/dist/testing/fixtures/events/LOCK.json +0 -27
  22. package/dist/testing/fixtures/events/account.deleted.json +0 -36
  23. package/dist/testing/fixtures/events/account.state_changed.json +0 -53
  24. package/dist/testing/fixtures/events/account.updated.json +0 -37
  25. package/dist/testing/fixtures/events/checkout.completed.json +0 -36
  26. package/dist/testing/fixtures/events/checkout.expired.json +0 -26
  27. package/dist/testing/fixtures/events/checkout.failed.json +0 -27
  28. package/dist/testing/fixtures/events/invoice.created.json +0 -37
  29. package/dist/testing/fixtures/events/invoice.issued.json +0 -38
  30. package/dist/testing/fixtures/events/invoice.voided.json +0 -39
  31. package/dist/testing/fixtures/events/subscription.activated.json +0 -40
  32. package/dist/testing/fixtures/events/subscription.cancel_scheduled.json +0 -38
  33. package/dist/testing/fixtures/events/subscription.canceled.json +0 -29
  34. package/dist/testing/fixtures/events/subscription.expired.json +0 -27
  35. package/dist/testing/fixtures/events/subscription.payment_failed.json +0 -38
  36. package/dist/testing/fixtures/events/subscription.reactivated.json +0 -36
  37. package/dist/testing/fixtures/events/subscription.renewed.json +0 -39
  38. package/dist/testing/fixtures/events/subscription.suspended.json +0 -36
  39. package/dist/testing/fixtures/events/subscription.terminated.json +0 -28
  40. package/dist/testing.d.ts +0 -656
  41. package/dist/testing.js +0 -3684
@@ -1,37 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000010",
3
- "type": "account.updated",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 3,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "changed": [
33
- "entitlements"
34
- ]
35
- }
36
- }
37
- }
@@ -1,36 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000011",
3
- "type": "checkout.completed",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 1,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "checkoutSessionId": "0192f1a0-0000-7000-8000-000000000004",
33
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001"
34
- }
35
- }
36
- }
@@ -1,26 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000013",
3
- "type": "checkout.expired",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 0,
11
- "planCode": "free",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": 3,
15
- "max_devices": 15,
16
- "max_networks_per_account": 1,
17
- "max_approved_routes": 1,
18
- "max_exit_nodes": 0
19
- },
20
- "subscription": null
21
- },
22
- "detail": {
23
- "checkoutSessionId": "0192f1a0-0000-7000-8000-000000000004"
24
- }
25
- }
26
- }
@@ -1,27 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000012",
3
- "type": "checkout.failed",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 0,
11
- "planCode": "free",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": 3,
15
- "max_devices": 15,
16
- "max_networks_per_account": 1,
17
- "max_approved_routes": 1,
18
- "max_exit_nodes": 0
19
- },
20
- "subscription": null
21
- },
22
- "detail": {
23
- "checkoutSessionId": "0192f1a0-0000-7000-8000-000000000004",
24
- "reason": "provider:card_declined"
25
- }
26
- }
27
- }
@@ -1,37 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-00000000001d",
3
- "type": "invoice.created",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 2,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "invoiceId": "0192f1a0-0000-7000-8000-000000000003",
33
- "totalMinor": 125000,
34
- "currency": "TRY"
35
- }
36
- }
37
- }
@@ -1,38 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-00000000001e",
3
- "type": "invoice.issued",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 2,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "invoiceId": "0192f1a0-0000-7000-8000-000000000003",
33
- "number": "NXS2026000000123",
34
- "totalMinor": 125000,
35
- "currency": "TRY"
36
- }
37
- }
38
- }
@@ -1,39 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000f4f",
3
- "type": "invoice.voided",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "ref": "acct_42",
11
- "displayName": "Örnek A.Ş.",
12
- "version": 4,
13
- "updatedAt": "2026-09-20T09:00:00Z",
14
- "planCode": "enterprise",
15
- "accessState": "active",
16
- "entitlements": {
17
- "max_users": null,
18
- "max_devices": null,
19
- "max_networks_per_account": 20,
20
- "max_approved_routes": 100,
21
- "max_exit_nodes": 10
22
- },
23
- "catalogVersion": "3f2a9c0e7b41d8a65c09e1f4b7d2a8c3",
24
- "subscription": null,
25
- "openCheckout": null,
26
- "profile": {
27
- "present": true,
28
- "kind": "company"
29
- }
30
- },
31
- "detail": {
32
- "invoiceId": "0192f1a0-0000-7000-8000-000000000004",
33
- "number": "NXS2026000000124",
34
- "totalMinor": 6000000,
35
- "currency": "TRY",
36
- "reason": "sözleşme yeniden düzenlendi"
37
- }
38
- }
39
- }
@@ -1,40 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000014",
3
- "type": "subscription.activated",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 1,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
33
- "planCode": "team",
34
- "interval": "month",
35
- "amountMinor": 125000,
36
- "currency": "TRY",
37
- "actorRef": "user:42"
38
- }
39
- }
40
- }
@@ -1,38 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000019",
3
- "type": "subscription.cancel_scheduled",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 2,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": "2026-11-01T09:00:00Z"
29
- }
30
- },
31
- "detail": {
32
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
33
- "cancelAt": "2026-11-01T09:00:00Z",
34
- "reason": "müşteri talebi",
35
- "actorRef": "staff:7"
36
- }
37
- }
38
- }
@@ -1,29 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-00000000001a",
3
- "type": "subscription.canceled",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 2,
11
- "planCode": "free",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": 3,
15
- "max_devices": 15,
16
- "max_networks_per_account": 1,
17
- "max_approved_routes": 1,
18
- "max_exit_nodes": 0
19
- },
20
- "subscription": null
21
- },
22
- "detail": {
23
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
24
- "reason": "müşteri talebi",
25
- "effectiveAt": "2026-10-15T12:00:00Z",
26
- "actorRef": "staff:7"
27
- }
28
- }
29
- }
@@ -1,27 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-00000000001b",
3
- "type": "subscription.expired",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 3,
11
- "planCode": "free",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": 3,
15
- "max_devices": 15,
16
- "max_networks_per_account": 1,
17
- "max_approved_routes": 1,
18
- "max_exit_nodes": 0
19
- },
20
- "subscription": null
21
- },
22
- "detail": {
23
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
24
- "effectiveAt": "2026-11-01T09:00:00Z"
25
- }
26
- }
27
- }
@@ -1,38 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000016",
3
- "type": "subscription.payment_failed",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 2,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "past_due",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
33
- "paymentId": "0192f1a0-0000-7000-8000-000000000002",
34
- "attempt": 1,
35
- "nextRetryAt": "2026-11-02T09:00:00Z"
36
- }
37
- }
38
- }
@@ -1,36 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000018",
3
- "type": "subscription.reactivated",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 4,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
33
- "paymentId": "0192f1a0-0000-7000-8000-000000000002"
34
- }
35
- }
36
- }
@@ -1,39 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000015",
3
- "type": "subscription.renewed",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 2,
11
- "planCode": "team",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "active",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-12-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
33
- "paymentId": "0192f1a0-0000-7000-8000-000000000002",
34
- "periodStart": "2026-11-01T09:00:00Z",
35
- "periodEnd": "2026-12-01T09:00:00Z",
36
- "invoiceId": "0192f1a0-0000-7000-8000-000000000003"
37
- }
38
- }
39
- }
@@ -1,36 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-000000000017",
3
- "type": "subscription.suspended",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 3,
11
- "planCode": "team",
12
- "accessState": "suspended",
13
- "entitlements": {
14
- "max_users": null,
15
- "max_devices": 250,
16
- "max_networks_per_account": 3,
17
- "max_approved_routes": 10,
18
- "max_exit_nodes": 1
19
- },
20
- "subscription": {
21
- "id": "0192f1a0-0000-7000-8000-000000000001",
22
- "status": "suspended",
23
- "planCode": "team",
24
- "interval": "month",
25
- "amountMinor": 125000,
26
- "currency": "TRY",
27
- "currentPeriodEnd": "2026-11-01T09:00:00Z",
28
- "cancelAt": null
29
- }
30
- },
31
- "detail": {
32
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
33
- "dunningDay": 7
34
- }
35
- }
36
- }
@@ -1,28 +0,0 @@
1
- {
2
- "id": "evt_0192f1a0-0000-7000-8000-00000000001c",
3
- "type": "subscription.terminated",
4
- "apiVersion": "2026-10-01",
5
- "createdAt": "2026-10-01T09:00:00Z",
6
- "product": "example",
7
- "accountRef": "acct_42",
8
- "data": {
9
- "account": {
10
- "version": 5,
11
- "planCode": "free",
12
- "accessState": "active",
13
- "entitlements": {
14
- "max_users": 3,
15
- "max_devices": 15,
16
- "max_networks_per_account": 1,
17
- "max_approved_routes": 1,
18
- "max_exit_nodes": 0
19
- },
20
- "subscription": null
21
- },
22
- "detail": {
23
- "subscriptionId": "0192f1a0-0000-7000-8000-000000000001",
24
- "reason": "nonpayment",
25
- "dunningDay": 30
26
- }
27
- }
28
- }