@kirimdev/sdk 3.3.0 → 3.5.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
@@ -1,98 +1,98 @@
1
- # @kirimdev/sdk
2
-
3
- Official TypeScript SDK for the [Kirimdev](https://kirimdev.com) Public API.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install @kirimdev/sdk
9
- # or
10
- bun add @kirimdev/sdk
11
- ```
12
-
13
- ## Quickstart
14
-
15
- ```ts
16
- import { Kirim } from '@kirimdev/sdk'
17
-
18
- const kirim = new Kirim({ apiKey: process.env.KIRIM_API_KEY! })
19
-
20
- // Scope to a WhatsApp phone number (Meta `business_phone_number_id`).
21
- // Look it up via `kirim.accounts.list()` if you don't have it handy.
22
- const phone = kirim.phoneNumbers('106540352242922')
23
-
24
- // Send a message
25
- const msg = await phone.messages.send({
26
- messaging_product: 'whatsapp',
27
- to: '628123456789',
28
- type: 'text',
29
- text: { body: 'Halo dari SDK!' },
30
- })
31
-
32
- // Paginate
33
- for await (const m of phone.messages.list({ limit: 50 })) {
34
- console.log(m.id, m.status)
35
- }
36
- ```
37
-
38
- ## Webhook verification
39
-
40
- `verifyWebhookSignature` parses the `X-Kirim-Signature` header (Stripe-style
41
- `t=<unix>,v1=<hex>` format), checks the timestamp against a tolerance window,
42
- verifies the HMAC-SHA256 against one or more active secrets (supports rotation),
43
- and returns the parsed JSON body. It **throws** on every failure mode — never
44
- returns `false`. Uses Web Crypto so it runs unchanged on Node 18+, Bun, Deno,
45
- and edge runtimes.
46
-
47
- ```ts
48
- import { verifyWebhookSignature, InvalidSignatureError } from '@kirimdev/sdk/webhooks'
49
-
50
- export async function POST(req: Request) {
51
- const rawBody = await req.text()
52
- try {
53
- const event = await verifyWebhookSignature({
54
- rawBody,
55
- signatureHeader: req.headers.get('x-kirim-signature'),
56
- secrets: [process.env.KIRIM_WEBHOOK_SECRET!],
57
- })
58
- // event is KirimWebhookEvent — narrow on event.type or event.object
59
- return new Response('ok')
60
- } catch (err) {
61
- if (err instanceof InvalidSignatureError) return new Response('bad sig', { status: 401 })
62
- throw err
63
- }
64
- }
65
- ```
66
-
67
- Errors thrown (all extend `KirimWebhookError`):
68
-
69
- - `InvalidSignatureError` — header missing/malformed, or no `v1=` matched any provided secret
70
- - `SignatureExpiredError` — `|now - t|` exceeds `toleranceSeconds` (default 300s)
71
- - `MalformedPayloadError` — signature matched but body is not valid JSON
72
-
73
- ## Features
74
-
75
- - Full coverage of the Kirimdev `/v1` API (~35 endpoints)
76
- - Type-safe — generated from the live OpenAPI 3.1 spec
77
- - Automatic retries with exponential backoff (429, 5xx, network errors)
78
- - Automatic `Idempotency-Key` injection for POST requests
79
- - Async iterator pagination (`for await ... of kirim.messages.list(...)`)
80
- - Typed error class hierarchy keyed off stable API error codes
81
- - Webhook HMAC-SHA256 verifier
82
- - Zero Node-specific dependencies — works in Node 18+, Bun, Deno
83
-
84
- ## Configuration
85
-
86
- ```ts
87
- new Kirim({
88
- apiKey: 'kdv_live_...', // required
89
- baseUrl: 'https://api.kirimdev.com/v1', // optional
90
- timeout: 30_000, // ms, default 30s
91
- maxRetries: 2, // default 2
92
- fetch: globalThis.fetch, // injectable for testing
93
- })
94
- ```
95
-
96
- ## License
97
-
98
- MIT
1
+ # @kirimdev/sdk
2
+
3
+ Official TypeScript SDK for the [Kirimdev](https://kirimdev.com) Public API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @kirimdev/sdk
9
+ # or
10
+ bun add @kirimdev/sdk
11
+ ```
12
+
13
+ ## Quickstart
14
+
15
+ ```ts
16
+ import { Kirim } from '@kirimdev/sdk'
17
+
18
+ const kirim = new Kirim({ apiKey: process.env.KIRIM_API_KEY! })
19
+
20
+ // Scope to a WhatsApp phone number (Meta `business_phone_number_id`).
21
+ // Look it up via `kirim.accounts.list()` if you don't have it handy.
22
+ const phone = kirim.phoneNumbers('106540352242922')
23
+
24
+ // Send a message
25
+ const msg = await phone.messages.send({
26
+ messaging_product: 'whatsapp',
27
+ to: '628123456789',
28
+ type: 'text',
29
+ text: { body: 'Halo dari SDK!' },
30
+ })
31
+
32
+ // Paginate
33
+ for await (const m of phone.messages.list({ limit: 50 })) {
34
+ console.log(m.id, m.status)
35
+ }
36
+ ```
37
+
38
+ ## Webhook verification
39
+
40
+ `verifyWebhookSignature` parses the `X-Kirim-Signature` header (Stripe-style
41
+ `t=<unix>,v1=<hex>` format), checks the timestamp against a tolerance window,
42
+ verifies the HMAC-SHA256 against one or more active secrets (supports rotation),
43
+ and returns the parsed JSON body. It **throws** on every failure mode — never
44
+ returns `false`. Uses Web Crypto so it runs unchanged on Node 18+, Bun, Deno,
45
+ and edge runtimes.
46
+
47
+ ```ts
48
+ import { verifyWebhookSignature, InvalidSignatureError } from '@kirimdev/sdk/webhooks'
49
+
50
+ export async function POST(req: Request) {
51
+ const rawBody = await req.text()
52
+ try {
53
+ const event = await verifyWebhookSignature({
54
+ rawBody,
55
+ signatureHeader: req.headers.get('x-kirim-signature'),
56
+ secrets: [process.env.KIRIM_WEBHOOK_SECRET!],
57
+ })
58
+ // event is KirimWebhookEvent — narrow on event.type or event.object
59
+ return new Response('ok')
60
+ } catch (err) {
61
+ if (err instanceof InvalidSignatureError) return new Response('bad sig', { status: 401 })
62
+ throw err
63
+ }
64
+ }
65
+ ```
66
+
67
+ Errors thrown (all extend `KirimWebhookError`):
68
+
69
+ - `InvalidSignatureError` — header missing/malformed, or no `v1=` matched any provided secret
70
+ - `SignatureExpiredError` — `|now - t|` exceeds `toleranceSeconds` (default 300s)
71
+ - `MalformedPayloadError` — signature matched but body is not valid JSON
72
+
73
+ ## Features
74
+
75
+ - Full coverage of the Kirimdev `/v1` API (~35 endpoints)
76
+ - Type-safe — generated from the live OpenAPI 3.1 spec
77
+ - Automatic retries with exponential backoff (429, 5xx, network errors)
78
+ - Automatic `Idempotency-Key` injection for POST requests
79
+ - Async iterator pagination (`for await ... of kirim.messages.list(...)`)
80
+ - Typed error class hierarchy keyed off stable API error codes
81
+ - Webhook HMAC-SHA256 verifier
82
+ - Zero Node-specific dependencies — works in Node 18+, Bun, Deno
83
+
84
+ ## Configuration
85
+
86
+ ```ts
87
+ new Kirim({
88
+ apiKey: 'kdv_live_...', // required
89
+ baseUrl: 'https://api.kirimdev.com/v1', // optional
90
+ timeout: 30_000, // ms, default 30s
91
+ maxRetries: 2, // default 2
92
+ fetch: globalThis.fetch, // injectable for testing
93
+ })
94
+ ```
95
+
96
+ ## License
97
+
98
+ MIT
@@ -58,7 +58,7 @@ export interface paths {
58
58
  };
59
59
  /**
60
60
  * Introspect the calling API key
61
- * @description Returns the organization, API key, and rate-limit tier associated with the bearer token. Use to verify key validity from automation scripts.
61
+ * @description Returns the organization, API key, rate-limit tier, and the list of teams under the organization associated with the bearer token. Use to verify key validity from automation scripts and to discover the `team_id` values required by team-scoped writes (e.g. `POST /v1/customers` on multi-team orgs).
62
62
  */
63
63
  get: {
64
64
  parameters: {
@@ -386,6 +386,7 @@ export interface paths {
386
386
  id?: string;
387
387
  caption?: string;
388
388
  filename?: string;
389
+ voice?: boolean;
389
390
  };
390
391
  } | {
391
392
  /** @enum {string} */
@@ -4833,6 +4834,15 @@ export interface components {
4833
4834
  write_per_minute: number;
4834
4835
  read_per_minute: number;
4835
4836
  };
4837
+ /** @description Teams under the organization, ordered by creation time (oldest first). For single-team orgs, `team_id` is auto-selected on writes; for multi-team orgs you must pass one of these ids explicitly. */
4838
+ teams: {
4839
+ /** @description Internal team id — pass this as `team_id` on team-scoped writes (e.g. `POST /v1/customers`). */
4840
+ id: string;
4841
+ /** @enum {string} */
4842
+ object: "team";
4843
+ name: string;
4844
+ slug: string;
4845
+ }[];
4836
4846
  };
4837
4847
  request_id: string;
4838
4848
  };
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION: "3.3.0";
1
+ export declare const SDK_VERSION: "3.5.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  // Regenerated on every prebuild / pretypecheck / pretest from
3
3
  // package.json so the User-Agent header stays in sync with the
4
4
  // published version.
5
- export const SDK_VERSION = "3.3.0";
5
+ export const SDK_VERSION = "3.5.0";
6
6
  //# sourceMappingURL=version.js.map
@@ -3,4 +3,4 @@
3
3
  // package.json so the User-Agent header stays in sync with the
4
4
  // published version.
5
5
 
6
- export const SDK_VERSION = "3.3.0" as const
6
+ export const SDK_VERSION = "3.5.0" as const
package/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ export type { Page, Paginator } from './pagination.js';
11
11
  export type { RequestOptions } from './http.js';
12
12
  export { KirimError, InvalidRequestError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, ApiServerError, ConnectionError, type KirimErrorType, type KirimErrorPayload, } from './errors.js';
13
13
  export type { Customer, CustomerStatus, CustomerWithAccounts, CustomerWhatsappAccountSummary, CustomerSetupLink, CustomerSetupLinkStatus, CustomerSetupLinkWithToken, CreateCustomerParams, UpdateCustomerParams, ListCustomersParams, CreateSetupLinkParams, UpdateSetupLinkParams, } from './resources/customers.js';
14
- export type { MeContext, Account, ListAccountsParams, Message, MessageListItem, SendMessageParams, ListMessagesParams, MessageMediaRedirect, Template, TemplateListItem, ListTemplatesParams, RetrieveTemplateParams, Conversation, ConversationListItem, ListConversationsParams, UpdateConversationParams, AttachConversationLabelParams, Contact, ContactListItem, ListContactsParams, CreateContactParams, UpdateContactParams, AttachContactLabelParams, BulkLabelContactsParams, Label, LabelListItem, ListLabelsParams, CreateLabelParams, UpdateLabelParams, WebhookSubscription, WebhookSubscriptionListItem, CreateWebhookSubscriptionParams, UpdateWebhookSubscriptionParams, AddWebhookSecret, WebhookDelivery, WebhookDeliveryListItem, ListWebhookDeliveriesParams, BulkReplayParams, BulkReplayResult, } from './types.js';
14
+ export type { MeContext, MePublicTeam, Account, ListAccountsParams, Message, MessageListItem, SendMessageParams, ListMessagesParams, MessageMediaRedirect, Template, TemplateListItem, ListTemplatesParams, RetrieveTemplateParams, Conversation, ConversationListItem, ListConversationsParams, UpdateConversationParams, AttachConversationLabelParams, Contact, ContactListItem, ListContactsParams, CreateContactParams, UpdateContactParams, AttachContactLabelParams, BulkLabelContactsParams, Label, LabelListItem, ListLabelsParams, CreateLabelParams, UpdateLabelParams, WebhookSubscription, WebhookSubscriptionListItem, CreateWebhookSubscriptionParams, UpdateWebhookSubscriptionParams, AddWebhookSecret, WebhookDelivery, WebhookDeliveryListItem, ListWebhookDeliveriesParams, BulkReplayParams, BulkReplayResult, } from './types.js';
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,8BAA8B,EAC9B,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EACV,SAAS,EACT,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,8BAA8B,EAC9B,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAA"}
package/dist/types.d.ts CHANGED
@@ -12,6 +12,7 @@ type ListData<T> = T extends {
12
12
  data: Array<infer D>;
13
13
  } ? D : never;
14
14
  export type MeContext = SingleData<Schemas['MeResponse']>;
15
+ export type MePublicTeam = MeContext['teams'][number];
15
16
  export type Account = ListData<Schemas['ListAccountsResponse']>;
16
17
  export type ListAccountsParams = NonNullable<paths['/accounts']['get']['parameters']['query']>;
17
18
  export type Message = SingleData<Schemas['GetMessageResponse']>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAE9D,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;AAG3C,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAA;AAC5D,KAAK,QAAQ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AAK,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAC3D,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,KAAK,CAAC,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAChE,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAA"}
package/openapi.json CHANGED
@@ -1105,12 +1105,44 @@
1105
1105
  "write_per_minute",
1106
1106
  "read_per_minute"
1107
1107
  ]
1108
+ },
1109
+ "teams": {
1110
+ "type": "array",
1111
+ "items": {
1112
+ "type": "object",
1113
+ "properties": {
1114
+ "id": {
1115
+ "type": "string",
1116
+ "description": "Internal team id — pass this as `team_id` on team-scoped writes (e.g. `POST /v1/customers`)."
1117
+ },
1118
+ "object": {
1119
+ "type": "string",
1120
+ "enum": [
1121
+ "team"
1122
+ ]
1123
+ },
1124
+ "name": {
1125
+ "type": "string"
1126
+ },
1127
+ "slug": {
1128
+ "type": "string"
1129
+ }
1130
+ },
1131
+ "required": [
1132
+ "id",
1133
+ "object",
1134
+ "name",
1135
+ "slug"
1136
+ ]
1137
+ },
1138
+ "description": "Teams under the organization, ordered by creation time (oldest first). For single-team orgs, `team_id` is auto-selected on writes; for multi-team orgs you must pass one of these ids explicitly."
1108
1139
  }
1109
1140
  },
1110
1141
  "required": [
1111
1142
  "organization",
1112
1143
  "api_key",
1113
- "rate_limits"
1144
+ "rate_limits",
1145
+ "teams"
1114
1146
  ]
1115
1147
  },
1116
1148
  "request_id": {
@@ -2367,7 +2399,7 @@
2367
2399
  "Meta"
2368
2400
  ],
2369
2401
  "summary": "Introspect the calling API key",
2370
- "description": "Returns the organization, API key, and rate-limit tier associated with the bearer token. Use to verify key validity from automation scripts.",
2402
+ "description": "Returns the organization, API key, rate-limit tier, and the list of teams under the organization associated with the bearer token. Use to verify key validity from automation scripts and to discover the `team_id` values required by team-scoped writes (e.g. `POST /v1/customers` on multi-team orgs).",
2371
2403
  "security": [
2372
2404
  {
2373
2405
  "bearerAuth": []
@@ -2804,6 +2836,9 @@
2804
2836
  "filename": {
2805
2837
  "type": "string",
2806
2838
  "maxLength": 255
2839
+ },
2840
+ "voice": {
2841
+ "type": "boolean"
2807
2842
  }
2808
2843
  }
2809
2844
  }
package/package.json CHANGED
@@ -1,63 +1,63 @@
1
- {
2
- "name": "@kirimdev/sdk",
3
- "version": "3.3.0",
4
- "description": "Official TypeScript SDK for the Kirimdev Public API.",
5
- "type": "module",
6
- "license": "MIT",
7
- "publishConfig": {
8
- "access": "public",
9
- "registry": "https://registry.npmjs.org/"
10
- },
11
- "keywords": [
12
- "kirim",
13
- "whatsapp",
14
- "whatsapp-business",
15
- "sdk",
16
- "api-client"
17
- ],
18
- "files": [
19
- "dist",
20
- "openapi.json",
21
- "README.md",
22
- "LICENSE"
23
- ],
24
- "main": "./dist/index.js",
25
- "module": "./dist/index.js",
26
- "types": "./dist/index.d.ts",
27
- "exports": {
28
- ".": {
29
- "types": "./dist/index.d.ts",
30
- "import": "./dist/index.js"
31
- },
32
- "./webhooks": {
33
- "types": "./dist/webhooks.d.ts",
34
- "import": "./dist/webhooks.js"
35
- },
36
- "./package.json": "./package.json"
37
- },
38
- "engines": {
39
- "node": ">=18"
40
- },
41
- "scripts": {
42
- "prebuild": "bun scripts/ensure-types.ts",
43
- "build": "tsc -p tsconfig.build.json && bun scripts/copy-generated.ts",
44
- "pretypecheck": "bun scripts/ensure-types.ts",
45
- "typecheck": "tsc --noEmit",
46
- "pretest": "bun scripts/ensure-types.ts",
47
- "test": "bun test",
48
- "lint": "tsc --noEmit",
49
- "sync": "bun scripts/sync-openapi.ts && bun scripts/generate-types.ts",
50
- "generate-types": "bun scripts/generate-types.ts",
51
- "check:drift": "bun scripts/check-drift.ts",
52
- "prepublishOnly": "bun run typecheck && bun run test && bun run build && bun scripts/verify-dist.ts"
53
- },
54
- "dependencies": {
55
- "openapi-fetch": "^0.13.0"
56
- },
57
- "devDependencies": {
58
- "@kirimdev/tsconfig": "workspace:*",
59
- "@types/bun": "latest",
60
- "openapi-typescript": "^7.4.0",
61
- "typescript": "^5.8.0"
62
- }
63
- }
1
+ {
2
+ "name": "@kirimdev/sdk",
3
+ "version": "3.5.0",
4
+ "description": "Official TypeScript SDK for the Kirimdev Public API.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "registry": "https://registry.npmjs.org/"
10
+ },
11
+ "keywords": [
12
+ "kirim",
13
+ "whatsapp",
14
+ "whatsapp-business",
15
+ "sdk",
16
+ "api-client"
17
+ ],
18
+ "files": [
19
+ "dist",
20
+ "openapi.json",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "main": "./dist/index.js",
25
+ "module": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js"
31
+ },
32
+ "./webhooks": {
33
+ "types": "./dist/webhooks.d.ts",
34
+ "import": "./dist/webhooks.js"
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "engines": {
39
+ "node": ">=18"
40
+ },
41
+ "scripts": {
42
+ "prebuild": "bun scripts/ensure-types.ts",
43
+ "build": "tsc -p tsconfig.build.json && bun scripts/copy-generated.ts",
44
+ "pretypecheck": "bun scripts/ensure-types.ts",
45
+ "typecheck": "tsc --noEmit",
46
+ "pretest": "bun scripts/ensure-types.ts",
47
+ "test": "bun test",
48
+ "lint": "tsc --noEmit",
49
+ "sync": "bun scripts/sync-openapi.ts && bun scripts/generate-types.ts",
50
+ "generate-types": "bun scripts/generate-types.ts",
51
+ "check:drift": "bun scripts/check-drift.ts",
52
+ "prepublishOnly": "bun run typecheck && bun run test && bun run build && bun scripts/verify-dist.ts"
53
+ },
54
+ "dependencies": {
55
+ "openapi-fetch": "^0.13.0"
56
+ },
57
+ "devDependencies": {
58
+ "@kirimdev/tsconfig": "workspace:*",
59
+ "@types/bun": "latest",
60
+ "openapi-typescript": "^7.4.0",
61
+ "typescript": "^5.8.0"
62
+ }
63
+ }