@pilot-status/sdk 0.4.0 → 0.8.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/CHANGELOG.md +51 -0
- package/README.md +203 -17
- package/dist/client.d.ts +53 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -4
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +58 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +65 -0
- package/dist/errors.js.map +1 -1
- package/dist/http.d.ts +7 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +3 -0
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +19 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +27 -0
- package/dist/internal.js.map +1 -0
- package/dist/resources/api-keys.d.ts +20 -7
- package/dist/resources/api-keys.d.ts.map +1 -1
- package/dist/resources/api-keys.js +18 -5
- package/dist/resources/api-keys.js.map +1 -1
- package/dist/resources/billing.d.ts +18 -0
- package/dist/resources/billing.d.ts.map +1 -0
- package/dist/resources/billing.js +30 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/branding.d.ts +18 -0
- package/dist/resources/branding.d.ts.map +1 -0
- package/dist/resources/branding.js +29 -0
- package/dist/resources/branding.js.map +1 -0
- package/dist/resources/chatwoot.d.ts +57 -0
- package/dist/resources/chatwoot.d.ts.map +1 -0
- package/dist/resources/chatwoot.js +117 -0
- package/dist/resources/chatwoot.js.map +1 -0
- package/dist/resources/conversations.d.ts +16 -0
- package/dist/resources/conversations.d.ts.map +1 -0
- package/dist/resources/conversations.js +28 -0
- package/dist/resources/conversations.js.map +1 -0
- package/dist/resources/embed.d.ts +24 -0
- package/dist/resources/embed.d.ts.map +1 -0
- package/dist/resources/embed.js +37 -0
- package/dist/resources/embed.js.map +1 -0
- package/dist/resources/flows.d.ts +203 -0
- package/dist/resources/flows.d.ts.map +1 -0
- package/dist/resources/flows.js +289 -0
- package/dist/resources/flows.js.map +1 -0
- package/dist/resources/groups.d.ts +37 -1
- package/dist/resources/groups.d.ts.map +1 -1
- package/dist/resources/groups.js +91 -0
- package/dist/resources/groups.js.map +1 -1
- package/dist/resources/messages.d.ts +61 -1
- package/dist/resources/messages.d.ts.map +1 -1
- package/dist/resources/messages.js +134 -1
- package/dist/resources/messages.js.map +1 -1
- package/dist/resources/meta.d.ts +19 -0
- package/dist/resources/meta.d.ts.map +1 -0
- package/dist/resources/meta.js +31 -0
- package/dist/resources/meta.js.map +1 -0
- package/dist/resources/numbers.d.ts +102 -1
- package/dist/resources/numbers.d.ts.map +1 -1
- package/dist/resources/numbers.js +152 -0
- package/dist/resources/numbers.js.map +1 -1
- package/dist/resources/service-window.d.ts +20 -0
- package/dist/resources/service-window.d.ts.map +1 -0
- package/dist/resources/service-window.js +26 -0
- package/dist/resources/service-window.js.map +1 -0
- package/dist/resources/subscription.d.ts +43 -0
- package/dist/resources/subscription.d.ts.map +1 -0
- package/dist/resources/subscription.js +60 -0
- package/dist/resources/subscription.js.map +1 -0
- package/dist/resources/templates.d.ts +31 -1
- package/dist/resources/templates.d.ts.map +1 -1
- package/dist/resources/templates.js +56 -0
- package/dist/resources/templates.js.map +1 -1
- package/dist/resources/webhooks.d.ts +53 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +97 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/resources/workspace.d.ts +57 -0
- package/dist/resources/workspace.d.ts.map +1 -0
- package/dist/resources/workspace.js +73 -0
- package/dist/resources/workspace.js.map +1 -0
- package/dist/types.d.ts +957 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/webhooks/parse.d.ts +16 -0
- package/dist/webhooks/parse.d.ts.map +1 -1
- package/dist/webhooks/parse.js +49 -0
- package/dist/webhooks/parse.js.map +1 -1
- package/dist/webhooks/signature.d.ts +42 -0
- package/dist/webhooks/signature.d.ts.map +1 -0
- package/dist/webhooks/signature.js +40 -0
- package/dist/webhooks/signature.js.map +1 -0
- package/dist/webhooks/types.d.ts +59 -1
- package/dist/webhooks/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/messages.test.d.ts +0 -2
- package/dist/messages.test.d.ts.map +0 -1
- package/dist/messages.test.js +0 -107
- package/dist/messages.test.js.map +0 -1
- package/dist/numbers.test.d.ts +0 -2
- package/dist/numbers.test.d.ts.map +0 -1
- package/dist/numbers.test.js +0 -57
- package/dist/numbers.test.js.map +0 -1
- package/dist/resources/groups.test.d.ts +0 -2
- package/dist/resources/groups.test.d.ts.map +0 -1
- package/dist/resources/groups.test.js +0 -19
- package/dist/resources/groups.test.js.map +0 -1
- package/dist/resources/newsletters.test.d.ts +0 -2
- package/dist/resources/newsletters.test.d.ts.map +0 -1
- package/dist/resources/newsletters.test.js +0 -19
- package/dist/resources/newsletters.test.js.map +0 -1
- package/dist/resources/projects.d.ts +0 -9
- package/dist/resources/projects.d.ts.map +0 -1
- package/dist/resources/projects.js +0 -23
- package/dist/resources/projects.js.map +0 -1
- package/dist/resources/templates.test.d.ts +0 -2
- package/dist/resources/templates.test.d.ts.map +0 -1
- package/dist/resources/templates.test.js +0 -28
- package/dist/resources/templates.test.js.map +0 -1
package/dist/errors.js
CHANGED
|
@@ -28,6 +28,13 @@ export class PilotStatusHttpError extends PilotStatusError {
|
|
|
28
28
|
export class AuthenticationError extends PilotStatusHttpError {
|
|
29
29
|
name = "AuthenticationError";
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* 400 — the REQUEST is wrong: a missing field, a bad type, a body we could not read.
|
|
33
|
+
*
|
|
34
|
+
* ⚠️ The remedy is always in the code that built the call. A refusal of the CONTENT of
|
|
35
|
+
* a well-formed request is {@link UnprocessableEntityError} (422) and is deliberately
|
|
36
|
+
* NOT a subclass of this one — see its docblock for why the two must not merge.
|
|
37
|
+
*/
|
|
31
38
|
export class ValidationError extends PilotStatusHttpError {
|
|
32
39
|
name = "ValidationError";
|
|
33
40
|
}
|
|
@@ -40,12 +47,68 @@ export class NotFoundError extends PilotStatusHttpError {
|
|
|
40
47
|
export class ConflictError extends PilotStatusHttpError {
|
|
41
48
|
name = "ConflictError";
|
|
42
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* 422 — the request was well-formed and the CONTENT was refused.
|
|
52
|
+
*
|
|
53
|
+
* ⛔ THIS IS NOT A {@link ValidationError}, AND THE SPLIT IS THE WHOLE POINT. A 400
|
|
54
|
+
* says "the call you built is wrong" and is fixed by editing the call site. A 422 says
|
|
55
|
+
* "the call was fine, and what it carried was refused": Meta rejected the Flow JSON,
|
|
56
|
+
* the number is not a Meta (Cloud API) one, the 24h service window has closed, the
|
|
57
|
+
* tenant is suspended. Those are fixed by editing the DOCUMENT, or the state of the
|
|
58
|
+
* account — never by re-reading the arguments. One status, one remedy.
|
|
59
|
+
*
|
|
60
|
+
* ⛔ IT DOES NOT EXTEND `ValidationError`, ON PURPOSE. `catch (e) { if (e instanceof
|
|
61
|
+
* ValidationError) … }` has to keep catching the 400 and has to NOT catch this; making
|
|
62
|
+
* 422 a subclass would route every content refusal into the "fix your arguments"
|
|
63
|
+
* branch, which is the exact confusion this class exists to end. To handle both, catch
|
|
64
|
+
* {@link PilotStatusHttpError} and read `status`.
|
|
65
|
+
*
|
|
66
|
+
* ⚠️ Before this class existed a 422 arrived as a bare `PilotStatusHttpError`, so a
|
|
67
|
+
* caller who branched only on `ValidationError` LOST THE CASE ENTIRELY — including the
|
|
68
|
+
* one 422 that carries the list of what was refused.
|
|
69
|
+
*/
|
|
70
|
+
export class UnprocessableEntityError extends PilotStatusHttpError {
|
|
71
|
+
name = "UnprocessableEntityError";
|
|
72
|
+
/**
|
|
73
|
+
* The refusal list the API sent, VERBATIM — or `null` when this 422 carried none.
|
|
74
|
+
*
|
|
75
|
+
* ⚠️ `null`, never `[]`, for an absent list: "refused, and the list was empty" has
|
|
76
|
+
* to stay distinguishable from "this 422 was never about a document at all"
|
|
77
|
+
* (`META_OUTSIDE_24H_WINDOW`, `BILLING_SUSPENDED`, `FLOW_REQUIRES_META_NUMBER` —
|
|
78
|
+
* none of which carry one).
|
|
79
|
+
*
|
|
80
|
+
* Today the only producer is `flows.uploadJson()` (422 `FLOW_JSON_INVALID`), where
|
|
81
|
+
* the list is META'S OWN: it names the line and the component it refused, its shape
|
|
82
|
+
* belongs to Meta and they change it without telling us. Print it, do not branch on
|
|
83
|
+
* its internals.
|
|
84
|
+
*
|
|
85
|
+
* ⚠️ This does NOT make `flowJsonValidationErrors()` redundant and that helper
|
|
86
|
+
* stays. It answers a narrower question — "is this specifically the Flow JSON
|
|
87
|
+
* refusal?", i.e. `code === "FLOW_JSON_INVALID"` — and it takes an `unknown`, so a
|
|
88
|
+
* `catch` block reads it without an `instanceof` first. This field answers "did
|
|
89
|
+
* this 422 carry a list?" and nothing more.
|
|
90
|
+
*/
|
|
91
|
+
validationErrors;
|
|
92
|
+
constructor(params) {
|
|
93
|
+
super(params);
|
|
94
|
+
const list = params.body
|
|
95
|
+
?.validationErrors;
|
|
96
|
+
this.validationErrors = Array.isArray(list) ? list : null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
43
99
|
export class RateLimitError extends PilotStatusHttpError {
|
|
44
100
|
name = "RateLimitError";
|
|
45
101
|
}
|
|
46
102
|
export class ServerError extends PilotStatusHttpError {
|
|
47
103
|
name = "ServerError";
|
|
48
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Maps an HTTP failure onto the narrowest class that describes it.
|
|
107
|
+
*
|
|
108
|
+
* ⚠️ A status with no branch here falls through to a bare {@link PilotStatusHttpError},
|
|
109
|
+
* which is not a neutral outcome: every caller that branches on classes stops seeing
|
|
110
|
+
* that case. Adding a branch is how a status becomes catchable.
|
|
111
|
+
*/
|
|
49
112
|
export function createHttpError(params) {
|
|
50
113
|
const status = params.status;
|
|
51
114
|
if (status === 401)
|
|
@@ -58,6 +121,8 @@ export function createHttpError(params) {
|
|
|
58
121
|
return new NotFoundError(params);
|
|
59
122
|
if (status === 409)
|
|
60
123
|
return new ConflictError(params);
|
|
124
|
+
if (status === 422)
|
|
125
|
+
return new UnprocessableEntityError(params);
|
|
61
126
|
if (status === 429)
|
|
62
127
|
return new RateLimitError(params);
|
|
63
128
|
if (status >= 500)
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAC9B,IAAI,GAAW,kBAAkB,CAAC;IAE3C,YAAY,OAAe,EAAE,OAA6B;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9B,IAA4B,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QACxD,CAAC;IACL,CAAC;CACJ;AAED,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IAC7C,IAAI,GAAW,sBAAsB,CAAC;IAEtC,MAAM,CAAS;IACf,MAAM,CAAS;IACf,GAAG,CAAS;IACZ,IAAI,CAAmC;IACvC,OAAO,CAAqB;IAC5B,OAAO,CAAyB;IAEzC,YAAY,MASX;QACG,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CA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CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;IAElD,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
package/dist/http.d.ts
CHANGED
|
@@ -6,9 +6,15 @@ export type HttpClientOptions = {
|
|
|
6
6
|
userAgent?: string;
|
|
7
7
|
fetch: FetchLike;
|
|
8
8
|
getRetries: number;
|
|
9
|
+
/**
|
|
10
|
+
* Goes out as `x-whatsapp-number-id` on every request. It is the server's
|
|
11
|
+
* routing selector: a tenant-scoped key WITHOUT it reaches neither
|
|
12
|
+
* `/v1/chatwoot*` (400 NUMBER_REQUIRED) nor the webhook logs.
|
|
13
|
+
*/
|
|
14
|
+
whatsappNumberId?: string;
|
|
9
15
|
};
|
|
10
16
|
export type HttpRequest = {
|
|
11
|
-
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
17
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
12
18
|
path: string;
|
|
13
19
|
query?: Record<string, string | number | boolean | undefined | null>;
|
|
14
20
|
body?: unknown;
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA+CF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB;kBAG5B,CAAC,OAAO,WAAW,KAAG,OAAO,CAAC,CAAC,CAAC;EAkF9D;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/http.js
CHANGED
|
@@ -57,6 +57,9 @@ export function createHttpClient(options) {
|
|
|
57
57
|
if (options.userAgent) {
|
|
58
58
|
headers["user-agent"] = options.userAgent;
|
|
59
59
|
}
|
|
60
|
+
if (options.whatsappNumberId) {
|
|
61
|
+
headers["x-whatsapp-number-id"] = options.whatsappNumberId;
|
|
62
|
+
}
|
|
60
63
|
let body;
|
|
61
64
|
if (req.body !== undefined) {
|
|
62
65
|
headers["content-type"] = "application/json";
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA0B9C,SAAS,gBAAgB,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,OAAO,CAAC,OAAe,EAAE,IAAY;IAC1C,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC7C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC;IAC1D,OAAO,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe,EAAE,IAAY,EAAE,KAA4B;IACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5C,IAAI,KAAK,EAAE,CAAC;QACR,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;gBAAE,SAAS;YACpD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;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,CAAC,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;wBAE/B,MAAM,eAAe,CAAC;4BAClB,OAAO;4BACP,MAAM,EAAE,GAAG,CAAC,MAAM;4BAClB,MAAM,EAAE,GAAG,CAAC,MAAM;4BAClB,GAAG;4BACH,IAAI,EAAE,MAAM;4BACZ,OAAO,EAAE,GAAG,IAAI,SAAS;4BACzB,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC;yBACxC,CAAC,CAAC;oBACP,CAAC;oBAED,OAAO,MAAW,CAAC;gBACvB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACX,IACI,OAAO,IAAI,UAAU;wBACrB,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;wBACvB,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAG,GAAW,EAAE,MAAM,CAAC,EACvD,CAAC;wBACC,MAAM,GAAG,CAAC;oBACd,CAAC;oBAED,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;oBAC7C,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;oBACnD,OAAO,IAAI,CAAC,CAAC;gBACjB,CAAC;YACL,CAAC;QACL,CAAC;gBAAS,CAAC;YACP,YAAY,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
export { PilotStatusClient } from "./client.js";
|
|
1
|
+
export { PilotStatusClient, DEFAULT_BASE_URL } from "./client.js";
|
|
2
2
|
export type { PilotStatusClientOptions } from "./client.js";
|
|
3
|
-
export { PilotStatusError, PilotStatusHttpError, AuthenticationError, ValidationError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError, } from "./errors.js";
|
|
3
|
+
export { PilotStatusError, PilotStatusHttpError, AuthenticationError, ValidationError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, ServerError, } from "./errors.js";
|
|
4
4
|
export type { PilotStatusErrorBody } from "./errors.js";
|
|
5
5
|
export { NUMBER_STATUS_FAILURE_CODES } from "./types.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Reads Meta's refusal list out of the error `flows.uploadJson()` throws. It is the
|
|
8
|
+
* ONLY place that list is reachable — see its own docblock.
|
|
9
|
+
*/
|
|
10
|
+
export { flowJsonValidationErrors } from "./resources/flows.js";
|
|
11
|
+
export type { MessageStatus, Button, ButtonType, MarketingOptions, SendMessageInput, SendMessageHeader, SendMessageAccepted, MessageDetails, MessageLogDirection, MessageLogEntry, MessageListParams, MessageListResult, GroupMessagesParams, GroupMessagesResult, UnreadMessagesParams, UnreadMessagesResult, MarkReadResult, TypingState, TypingInput, TypingResult, DashboardStats, ApiKeyCreated, ApiKeyListItem, ApiKeyListResult, NumberApiKeyReveal, RegeneratedNumberKey, WhatsAppNumberInstance, WhatsAppNumberListItem, NumberListItemApiKeyRef, CreateNumberInput, CreateNumberResult, CreateMetaNumberInput, CheckNumbersInput, CheckNumbersResult, NumberConnectResult, NumberStatusResult, NumberStatusFailureCode, NumberDetail, NumberSettings, NumberSettingsInput, NumberSettingsSync, NumberPiiInput, NumberLogoutResult, NumberRestoreResult, NumberPurgeResult, UpdateNumberInput, UpdateNumberResult, ChatHistoryMedia, ChatHistoryMessage, MessageHistoryParams, MessageHistoryResult, NumberLinkBundle, RemotePairingInput, RemotePairingResult, RemotePairingInfo, RemotePairingStatus, RemotePairingConnectResult, CancelMessagesResult, DeleteNumberResult, TemplateCategory, TemplateExamples, TemplateListItem, TemplateDetail, CreateTemplateInput, UpdateTemplateInput, TemplateDeleteResult, FlowCategory, Flow, FlowListParams, FlowListResult, CreateFlowInput, FlowCreated, UpdateFlowInput, FlowUpdateResult, FlowDeleteResult, FlowJsonUploadResult, FlowJsonValidationFailure, FlowPublishInput, FlowPublishResult, FlowDeprecateInput, FlowDeprecateResult, FlowResponse, FlowResponseListParams, FlowResponseListResult, FlowEndpointKeyMetaStatus, FlowEndpointKeyStatus, FlowEndpointKeyRotateInput, FlowEndpointKeyRotateResult, GroupListItem, GroupDetail, GroupParticipant, CreateGroupInput, GroupActionResult, GroupInviteResult, GroupPinAction, NewsletterListItem, MediaDownloadResult, ConversationListParams, ConversationListResult, ConversationSummary, ServiceWindowType, ServiceWindowResult, MetaPricingParams, MetaPricingResult, Webhook, CreateWebhookInput, UpdateWebhookInput, WebhookDeleteResult, WebhookLogsParams, WebhookLogEntry, BrandingInput, BrandingResult, EmbedSurface, EmbedSessionInput, EmbedSessionResult, CheckoutPurpose, CheckoutInput, CheckoutResult, ExtraNumbersPreview, ExtraNumbersPurchaseResult, ExtraNumbersScheduleResult, ChatwootChannelMode, ChatwootStatus, ChatwootConnectInput, ChatwootUpdateInput, ChatwootTestInput, ChatwootTestResult, ChatwootHistoryReplayInput, ChatwootHistoryReplayState, WorkspaceRole, WorkspaceMemberStatus, WorkspaceDetail, WorkspaceMember, WorkspaceMemberList, CallDirection, CallStatus, CallDetails, CallInitiateInput, CallInitiateAccepted, CallActionResult, CallListResult, CallingSettingsResult, CallSettingsUpdateInput, CallSettingsUpdateResult, CallPermissionResult, CallPermissionRequestInput, CallPermissionRequestResult, CallRealtimeSessionMode, CallRealtimeSessionResult, } from "./types.js";
|
|
12
|
+
export type { CustomerWebhookEvent, WhatsAppMessageType, MessageSentEvent, MessageDeliveredEvent, MessageReadEvent, MessageFailedEvent, MessageReplyEvent, MessageReceivedEvent, MessageGroupEvent, MessageNewsletterEvent, NumberCreatedEvent, NumberConnectedEvent, NumberDisconnectedEvent, NumberRemovedEvent, CallRingingEvent, CallConnectedEvent, CallEndedEvent, CallMissedEvent, CallPermissionUpdatedEvent, EvolutionGoCallEventData, EvolutionGoCallOfferEvent, EvolutionGoCallAcceptEvent, EvolutionGoCallTerminateEvent, EvolutionGoCallEvent, FlowResponseReceivedEvent, FlowResponseReceivedEventData, } from "./webhooks/types.js";
|
|
13
|
+
export { parseCustomerWebhook, isCustomerWebhookEvent, CUSTOMER_WEBHOOK_EVENTS, } from "./webhooks/parse.js";
|
|
14
|
+
export { verifyWebhookSignature, WEBHOOK_SIGNATURE_HEADER, } from "./webhooks/signature.js";
|
|
15
|
+
export type { VerifyWebhookSignatureInput } from "./webhooks/signature.js";
|
|
9
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,YAAY,EACV,aAAa,EACb,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,oB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HANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
1
|
+
// mutation-exempt-file: PURE RE-EXPORT BARREL — 209 lines, every one of them `export … from`, with no statement, no expression and no branch to mutate. Its 7 value re-exports are each ASSERTED in the test of the module they come from, so nothing here is unmeasured: `PilotStatusClient`/`DEFAULT_BASE_URL` in `client.test.ts`; the 10 error classes (`UnprocessableEntityError` included, 16 references, structural assertions on the prototype chain) in `errors.test.ts`; `NUMBER_STATUS_FAILURE_CODES` in `resources/resources.test.ts`, list asserted whole; `flowJsonValidationErrors` in `resources/flows.test.ts`; `parseCustomerWebhook`/`isCustomerWebhookEvent` in `webhooks/parse.test.ts`; `CUSTOMER_WEBHOOK_EVENTS` in `webhooks/readme-events.test.ts`, compared name-by-name against `README.md`; `verifyWebhookSignature`/`WEBHOOK_SIGNATURE_HEADER` in `webhooks/signature.test.ts`. Everything else it forwards is `export type`, erased before a mutant could exist. This is the declared escape hatch for the gate's OWN documented limit — `mutate-diff.mjs` does not follow barrels, so a barrel resolves to `index` and lands in `semTeste`; the same reason already excludes this exact file from `vitest.coverage.config.ts` ("pure re-export barrel"). A dropped export is caught by `tsc`, in this package and in every consumer, not by mutation.
|
|
2
|
+
export { PilotStatusClient, DEFAULT_BASE_URL } from "./client.js";
|
|
3
|
+
export { PilotStatusError, PilotStatusHttpError, AuthenticationError, ValidationError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, ServerError, } from "./errors.js";
|
|
3
4
|
export { NUMBER_STATUS_FAILURE_CODES } from "./types.js";
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Reads Meta's refusal list out of the error `flows.uploadJson()` throws. It is the
|
|
7
|
+
* ONLY place that list is reachable — see its own docblock.
|
|
8
|
+
*/
|
|
9
|
+
export { flowJsonValidationErrors } from "./resources/flows.js";
|
|
10
|
+
export { parseCustomerWebhook, isCustomerWebhookEvent, CUSTOMER_WEBHOOK_EVENTS, } from "./webhooks/parse.js";
|
|
11
|
+
export { verifyWebhookSignature, WEBHOOK_SIGNATURE_HEADER, } from "./webhooks/signature.js";
|
|
5
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qzCAAqzC;AAErzC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGlE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD;;;GAGG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAsLhE,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers internal to the resources. They are not exported from the public
|
|
3
|
+
* barrel: they are an implementation detail, not contract.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Drops the `undefined` keys from a body/query object.
|
|
7
|
+
*
|
|
8
|
+
* The reason a helper exists for this, instead of the conditional spread the
|
|
9
|
+
* older resources use (`...(x ? { x } : {})`), is the coverage gate: every
|
|
10
|
+
* conditional spread is a branch that needs TWO tests per field. With ~50 new
|
|
11
|
+
* methods that would multiply the tests by every optional field while proving
|
|
12
|
+
* nothing extra — here the branch is tested once, in this file.
|
|
13
|
+
*
|
|
14
|
+
* ⚠️ `null` is PRESERVED on purpose. In `PUT /v1/branding` and in the `settings`
|
|
15
|
+
* of `PATCH /v1/numbers/{id}`, `null` means "clear the field" / "go back to the
|
|
16
|
+
* provider default" — which is not the same as omitting it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function compact<T extends Record<string, unknown>>(obj: T): Partial<T>;
|
|
19
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAO7E"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers internal to the resources. They are not exported from the public
|
|
3
|
+
* barrel: they are an implementation detail, not contract.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Drops the `undefined` keys from a body/query object.
|
|
7
|
+
*
|
|
8
|
+
* The reason a helper exists for this, instead of the conditional spread the
|
|
9
|
+
* older resources use (`...(x ? { x } : {})`), is the coverage gate: every
|
|
10
|
+
* conditional spread is a branch that needs TWO tests per field. With ~50 new
|
|
11
|
+
* methods that would multiply the tests by every optional field while proving
|
|
12
|
+
* nothing extra — here the branch is tested once, in this file.
|
|
13
|
+
*
|
|
14
|
+
* ⚠️ `null` is PRESERVED on purpose. In `PUT /v1/branding` and in the `settings`
|
|
15
|
+
* of `PATCH /v1/numbers/{id}`, `null` means "clear the field" / "go back to the
|
|
16
|
+
* provider default" — which is not the same as omitting it.
|
|
17
|
+
*/
|
|
18
|
+
export function compact(obj) {
|
|
19
|
+
const out = {};
|
|
20
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
21
|
+
if (value === undefined)
|
|
22
|
+
continue;
|
|
23
|
+
out[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,OAAO,CAAoC,GAAM;IAC7D,MAAM,GAAG,GAAe,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,GAAG,CAAC,GAAc,CAAC,GAAG,KAAmB,CAAC;IAC9C,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ApiKeyListResult, RegeneratedNumberKey } from "../types.js";
|
|
3
3
|
export declare class ApiKeysResource {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(http: HttpClient);
|
|
6
6
|
/**
|
|
7
7
|
* List API keys (`GET /v1/api-keys`).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* ⚠️ **The return type depends on the credential's scope, and the old type
|
|
10
|
+
* lied about it**: it was a fixed `ApiKeyListItem[]`, while the same route
|
|
11
|
+
* answers `NumberApiKeyReveal[]` for a tenant-scoped key — anyone reading
|
|
12
|
+
* `.keyPrefix` with a tenant key got `undefined` while autocomplete claimed it
|
|
13
|
+
* existed. It is now the union, and the discriminant is `revealable`:
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const keys = await client.apiKeys.list();
|
|
17
|
+
* for (const k of keys) {
|
|
18
|
+
* if ("revealable" in k) {
|
|
19
|
+
* // TENANT-scoped key: one row per number, `k.key` in the clear when revealable
|
|
20
|
+
* } else {
|
|
21
|
+
* // NUMBER-scoped key: the masked keys of that number
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* A number-scoped credential gets `403 NUMBER_SCOPE_NOT_ALLOWED` — the endpoint
|
|
27
|
+
* manages the account's keys, so it requires account-wide reach.
|
|
15
28
|
*/
|
|
16
|
-
list(): Promise<
|
|
29
|
+
list(): Promise<ApiKeyListResult>;
|
|
17
30
|
/**
|
|
18
31
|
* Regenerate the default key of one WhatsApp number (`POST /v1/api-keys`).
|
|
19
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE1E,qBAAa,eAAe;;gBAGd,IAAI,EAAE,UAAU;IAI5B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAOvC;;;;;;OAMG;IACG,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAOhF"}
|
|
@@ -6,12 +6,25 @@ export class ApiKeysResource {
|
|
|
6
6
|
/**
|
|
7
7
|
* List API keys (`GET /v1/api-keys`).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* ⚠️ **The return type depends on the credential's scope, and the old type
|
|
10
|
+
* lied about it**: it was a fixed `ApiKeyListItem[]`, while the same route
|
|
11
|
+
* answers `NumberApiKeyReveal[]` for a tenant-scoped key — anyone reading
|
|
12
|
+
* `.keyPrefix` with a tenant key got `undefined` while autocomplete claimed it
|
|
13
|
+
* existed. It is now the union, and the discriminant is `revealable`:
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const keys = await client.apiKeys.list();
|
|
17
|
+
* for (const k of keys) {
|
|
18
|
+
* if ("revealable" in k) {
|
|
19
|
+
* // TENANT-scoped key: one row per number, `k.key` in the clear when revealable
|
|
20
|
+
* } else {
|
|
21
|
+
* // NUMBER-scoped key: the masked keys of that number
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* A number-scoped credential gets `403 NUMBER_SCOPE_NOT_ALLOWED` — the endpoint
|
|
27
|
+
* manages the account's keys, so it requires account-wide reach.
|
|
15
28
|
*/
|
|
16
29
|
async list() {
|
|
17
30
|
return this.#http.requestJson({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,eAAe;IACjB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,eAAe;IACjB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAmB;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,gBAAwB;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAuB;YAClD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,EAAE,gBAAgB,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { CheckoutInput, CheckoutResult } from "../types.js";
|
|
3
|
+
/** Billing (`/v1/billing/*`). Requires a tenant-scoped credential. */
|
|
4
|
+
export declare class BillingResource {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(http: HttpClient);
|
|
7
|
+
/**
|
|
8
|
+
* Generates the URL of a hosted payment page
|
|
9
|
+
* (`POST /v1/billing/checkout`).
|
|
10
|
+
*
|
|
11
|
+
* **Nothing is charged here.** The call only returns a `url`; the charge
|
|
12
|
+
* happens when a human completes the payment on that page. `purpose:
|
|
13
|
+
* "wallet_topup"` requires `amount` in the account currency; `"add_card"`
|
|
14
|
+
* only stores the card on file.
|
|
15
|
+
*/
|
|
16
|
+
createCheckout(input: CheckoutInput): Promise<CheckoutResult>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjE,sEAAsE;AACtE,qBAAa,eAAe;;gBAGZ,IAAI,EAAE,UAAU;IAI5B;;;;;;;;OAQG;IACG,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;CAYtE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { compact } from "../internal.js";
|
|
2
|
+
/** Billing (`/v1/billing/*`). Requires a tenant-scoped credential. */
|
|
3
|
+
export class BillingResource {
|
|
4
|
+
#http;
|
|
5
|
+
constructor(http) {
|
|
6
|
+
this.#http = http;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Generates the URL of a hosted payment page
|
|
10
|
+
* (`POST /v1/billing/checkout`).
|
|
11
|
+
*
|
|
12
|
+
* **Nothing is charged here.** The call only returns a `url`; the charge
|
|
13
|
+
* happens when a human completes the payment on that page. `purpose:
|
|
14
|
+
* "wallet_topup"` requires `amount` in the account currency; `"add_card"`
|
|
15
|
+
* only stores the card on file.
|
|
16
|
+
*/
|
|
17
|
+
async createCheckout(input) {
|
|
18
|
+
return this.#http.requestJson({
|
|
19
|
+
method: "POST",
|
|
20
|
+
path: "/v1/billing/checkout",
|
|
21
|
+
body: compact({
|
|
22
|
+
purpose: input.purpose,
|
|
23
|
+
amount: input.amount,
|
|
24
|
+
successUrl: input.successUrl,
|
|
25
|
+
cancelUrl: input.cancelUrl,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=billing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,sEAAsE;AACtE,MAAM,OAAO,eAAe;IACf,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CAAC,KAAoB;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAiB;YAC1C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,OAAO,CAAC;gBACV,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,SAAS,EAAE,KAAK,CAAC,SAAS;aAC7B,CAAC;SACL,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { BrandingInput, BrandingResult } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* White-label branding of the connect / remote-pairing pages
|
|
5
|
+
* (`GET|PUT /v1/branding`). Requires a tenant-scoped credential.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BrandingResource {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(http: HttpClient);
|
|
10
|
+
get(): Promise<BrandingResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Partial upsert: an omitted field stays as it is, a field set to `null` is
|
|
13
|
+
* CLEARED. That is why the body goes out raw, without `compact` — `null` here
|
|
14
|
+
* is a value, not an absence.
|
|
15
|
+
*/
|
|
16
|
+
update(input: BrandingInput): Promise<BrandingResult>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=branding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/resources/branding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjE;;;GAGG;AACH,qBAAa,gBAAgB;;gBAGb,IAAI,EAAE,UAAU;IAItB,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;IAOpC;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;CAO9D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* White-label branding of the connect / remote-pairing pages
|
|
3
|
+
* (`GET|PUT /v1/branding`). Requires a tenant-scoped credential.
|
|
4
|
+
*/
|
|
5
|
+
export class BrandingResource {
|
|
6
|
+
#http;
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.#http = http;
|
|
9
|
+
}
|
|
10
|
+
async get() {
|
|
11
|
+
return this.#http.requestJson({
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: "/v1/branding",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Partial upsert: an omitted field stays as it is, a field set to `null` is
|
|
18
|
+
* CLEARED. That is why the body goes out raw, without `compact` — `null` here
|
|
19
|
+
* is a value, not an absence.
|
|
20
|
+
*/
|
|
21
|
+
async update(input) {
|
|
22
|
+
return this.#http.requestJson({
|
|
23
|
+
method: "PUT",
|
|
24
|
+
path: "/v1/branding",
|
|
25
|
+
body: input,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=branding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.js","sourceRoot":"","sources":["../../src/resources/branding.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAChB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAiB;YAC1C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc;SACvB,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,KAAoB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAiB;YAC1C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,KAAK;SACd,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { ChatwootConnectInput, ChatwootHistoryReplayInput, ChatwootHistoryReplayState, ChatwootStatus, ChatwootTestInput, ChatwootTestResult, ChatwootUpdateInput } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Mirroring into Chatwoot (`/v1/chatwoot*`).
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ **All 8 endpoints are PER NUMBER.** With a tenant-scoped key and no resolved
|
|
7
|
+
* number they answer `400 NUMBER_REQUIRED` — build the client with
|
|
8
|
+
* `whatsappNumberId`, or use `client.withNumber(id).chatwoot.…`. With a
|
|
9
|
+
* number-scoped key the key's number wins and the header is ignored.
|
|
10
|
+
*
|
|
11
|
+
* The Chatwoot `userAccessToken` never comes back in any response; what you can
|
|
12
|
+
* observe is `hasToken`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ChatwootResource {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(http: HttpClient);
|
|
17
|
+
get(): Promise<ChatwootStatus>;
|
|
18
|
+
/**
|
|
19
|
+
* Connects (or reconnects with a new credential). It validates against the
|
|
20
|
+
* Chatwoot instance, creates the inbox and starts mirroring. It is worth
|
|
21
|
+
* running {@link test} first — that one writes nothing.
|
|
22
|
+
*/
|
|
23
|
+
connect(input: ChatwootConnectInput): Promise<ChatwootStatus>;
|
|
24
|
+
/**
|
|
25
|
+
* Partial update of an existing integration.
|
|
26
|
+
*
|
|
27
|
+
* `enabled: false` PAUSES the mirroring without disconnecting. Changing
|
|
28
|
+
* `instanceUrl`/`accountId`/`userAccessToken` re-runs the whole connect and
|
|
29
|
+
* RECREATES the inbox; `action: "reconnect"` rebuilds the inbox reusing the
|
|
30
|
+
* stored credential.
|
|
31
|
+
*/
|
|
32
|
+
update(input: ChatwootUpdateInput): Promise<ChatwootStatus>;
|
|
33
|
+
/**
|
|
34
|
+
* Disconnects (idempotent). `deleteInbox: true` ALSO deletes the remote inbox
|
|
35
|
+
* in Chatwoot, along with the history that lives there. To merely pause,
|
|
36
|
+
* prefer `update({ enabled: false })`.
|
|
37
|
+
*/
|
|
38
|
+
disconnect(params?: {
|
|
39
|
+
deleteInbox?: boolean;
|
|
40
|
+
}): Promise<ChatwootStatus>;
|
|
41
|
+
/** Dry-run of the credentials: creates no inbox and writes nothing. Omit `userAccessToken` to reuse the stored one. */
|
|
42
|
+
test(input: ChatwootTestInput): Promise<ChatwootTestResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Pushes this number's ALREADY STORED history into the connected inbox
|
|
45
|
+
* (`POST /v1/chatwoot/history-sync`). Only for Meta numbers in COEXISTENCE
|
|
46
|
+
* with Chatwoot on the API channel.
|
|
47
|
+
*
|
|
48
|
+
* Messages go in oldest to newest with the original date/time prefixed INTO
|
|
49
|
+
* THE BODY — Chatwoot ignores `created_at` on the API, so there is no way to
|
|
50
|
+
* truly backdate them. Idempotent: running it again only re-posts what did
|
|
51
|
+
* not make it through.
|
|
52
|
+
*/
|
|
53
|
+
startHistoryReplay(input?: ChatwootHistoryReplayInput): Promise<ChatwootHistoryReplayState>;
|
|
54
|
+
getHistoryReplay(): Promise<ChatwootHistoryReplayState>;
|
|
55
|
+
cancelHistoryReplay(): Promise<ChatwootHistoryReplayState>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=chatwoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatwoot.d.ts","sourceRoot":"","sources":["../../src/resources/chatwoot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACR,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACtB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB;;gBAGb,IAAI,EAAE,UAAU;IAItB,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;IAOpC;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAanE;;;;;;;OAOG;IACG,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAejE;;;;OAIG;IACG,UAAU,CAAC,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAQ7E,uHAAuH;IACjH,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAYjE;;;;;;;;;OASG;IACG,kBAAkB,CACpB,KAAK,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,0BAA0B,CAAC;IAQhC,gBAAgB,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAOvD,mBAAmB,IAAI,OAAO,CAAC,0BAA0B,CAAC;CAMnE"}
|