@atlasauth/backend 0.7.0 → 0.7.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/CHANGELOG.md +5 -0
- package/dist/client/error.d.ts +2 -0
- package/dist/client/error.js +2 -0
- package/dist/client/error.js.map +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/messaging.d.ts +10 -1
- package/dist/client/messaging.js +13 -2
- package/dist/client/messaging.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @atlasauth/backend changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
- **Email provider removal.** `messaging.deleteChannel(channel, options?)` accepts `{ force?: boolean }` (sent as `?force=true`). Removing the email provider is refused with `409 EMAIL_PROVIDER_IN_USE` while email-dependent features are on and nothing else would deliver for the instance; `meta.features` names them.
|
|
5
|
+
- **Error codes.** `AtlasErrorCodes` adds `EMAIL_PROVIDER_IN_USE`.
|
|
6
|
+
- **Compatible.** The new argument is optional; no signatures changed.
|
|
7
|
+
|
|
3
8
|
## 0.7.0
|
|
4
9
|
- **API key spend caps.** `apiKeys.create` and `apiKeys.update` accept `limits` (`ApiKeyLimit[]`: `{ unit, amount, period: 'request' | 'day' | 'month' | 'total' }`, or `null` to clear). `ApiKey` gains `limits` and `usage` (`ApiKeyLimitState[]`: `{ unit, period, amount, used, remaining, window_start, resets_at }`).
|
|
5
10
|
- **Usage metering.** `apiKeys.recordUsage(id, { amount, unit, idempotency_key? })` returns `ApiKeyUsageDebit` (`key_id`, `unit`, `amount`, `allowed`, `code`, `exceeded`, `usage`, `counters`, `idempotent_replay`); a refusal resolves with `allowed: false`. `apiKeys.getUsage(id)` returns `ApiKeyUsage` (`key_id`, `limits`, `usage`, `counters`). New types: `ApiKeyLimit`, `ApiKeyLimitPeriod`, `ApiKeyLimitState`, `ApiKeyUsageCounter`, `RecordApiKeyUsageBody`, `ApiKeyUsageDebit`, `ApiKeyUsage`.
|
package/dist/client/error.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export declare const AtlasErrorCodes: {
|
|
|
39
39
|
readonly EMAIL_DELIVERY_NOT_CONFIGURED: "EMAIL_DELIVERY_NOT_CONFIGURED";
|
|
40
40
|
/** This setting needs your own email provider configured first. */
|
|
41
41
|
readonly EMAIL_PROVIDER_REQUIRED: "EMAIL_PROVIDER_REQUIRED";
|
|
42
|
+
/** The email provider can't be removed while email-dependent features need it (`meta.features`). */
|
|
43
|
+
readonly EMAIL_PROVIDER_IN_USE: "EMAIL_PROVIDER_IN_USE";
|
|
42
44
|
/** Strict mode: the body had a field this endpoint does not accept (`param` names it). */
|
|
43
45
|
readonly UNKNOWN_FIELD: "UNKNOWN_FIELD";
|
|
44
46
|
/** The billing plan still has subscribers and cannot be removed. */
|
package/dist/client/error.js
CHANGED
|
@@ -35,6 +35,8 @@ exports.AtlasErrorCodes = {
|
|
|
35
35
|
EMAIL_DELIVERY_NOT_CONFIGURED: 'EMAIL_DELIVERY_NOT_CONFIGURED',
|
|
36
36
|
/** This setting needs your own email provider configured first. */
|
|
37
37
|
EMAIL_PROVIDER_REQUIRED: 'EMAIL_PROVIDER_REQUIRED',
|
|
38
|
+
/** The email provider can't be removed while email-dependent features need it (`meta.features`). */
|
|
39
|
+
EMAIL_PROVIDER_IN_USE: 'EMAIL_PROVIDER_IN_USE',
|
|
38
40
|
/** Strict mode: the body had a field this endpoint does not accept (`param` names it). */
|
|
39
41
|
UNKNOWN_FIELD: 'UNKNOWN_FIELD',
|
|
40
42
|
/** The billing plan still has subscribers and cannot be removed. */
|
package/dist/client/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/client/error.ts"],"names":[],"mappings":";;;AAoBA,MAAa,aAAc,SAAQ,KAAK;IACpB,IAAI,GAAG,eAAe,CAAC;IACzC,0CAA0C;IACjC,MAAM,CAAS;IAC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gD;IAChD,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,iBAAiB,EAAE,mBAAmB;IACtC,YAAY,EAAE,cAAc;IAC5B,4FAA4F;IAC5F,oBAAoB,EAAE,sBAAsB;IAC5C,yFAAyF;IACzF,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,oBAAoB,EAAE,sBAAsB;IAC5C,eAAe,EAAE,iBAAiB;IAClC,aAAa,EAAE,eAAe;IAC9B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACZ,CAAC"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -832,7 +832,9 @@ declare function buildNamespaces(request: RequestFn): {
|
|
|
832
832
|
transport: T;
|
|
833
833
|
} & (string extends T ? unknown : never)): Promise<import("./messaging").MessagingProvider>;
|
|
834
834
|
};
|
|
835
|
-
deleteChannel(channel: "email" | "sms"
|
|
835
|
+
deleteChannel(channel: "email" | "sms", options?: {
|
|
836
|
+
force?: boolean;
|
|
837
|
+
}): Promise<import("./messaging").DeletedMessagingProvider>;
|
|
836
838
|
test(channel: "email" | "sms", body: {
|
|
837
839
|
to: string;
|
|
838
840
|
}): Promise<import("./messaging").MessagingTestResult>;
|
|
@@ -313,7 +313,16 @@ export declare function messagingResource(request: RequestFn): {
|
|
|
313
313
|
(body: SmsProviderInput): Promise<SmsProvider>;
|
|
314
314
|
<T extends string>(body: LegacyInput<T>): Promise<MessagingProvider>;
|
|
315
315
|
};
|
|
316
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Remove a channel's provider. Removing the email provider is refused with
|
|
318
|
+
* `409 EMAIL_PROVIDER_IN_USE` (`meta.features` names them) while
|
|
319
|
+
* email-dependent features are on and nothing else would deliver for the
|
|
320
|
+
* instance; pass `{ force: true }` to remove it anyway — those features then
|
|
321
|
+
* stop being offered until a provider is configured again.
|
|
322
|
+
*/
|
|
323
|
+
deleteChannel(channel: "email" | "sms", options?: {
|
|
324
|
+
force?: boolean;
|
|
325
|
+
}): Promise<DeletedMessagingProvider>;
|
|
317
326
|
/** Send a fixed, clearly-marked test message through the channel's provider. */
|
|
318
327
|
test(channel: "email" | "sms", body: {
|
|
319
328
|
to: string;
|
package/dist/client/messaging.js
CHANGED
|
@@ -26,8 +26,19 @@ function messagingResource(request) {
|
|
|
26
26
|
* secrets — keep their stored values.
|
|
27
27
|
*/
|
|
28
28
|
setSms,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Remove a channel's provider. Removing the email provider is refused with
|
|
31
|
+
* `409 EMAIL_PROVIDER_IN_USE` (`meta.features` names them) while
|
|
32
|
+
* email-dependent features are on and nothing else would deliver for the
|
|
33
|
+
* instance; pass `{ force: true }` to remove it anyway — those features then
|
|
34
|
+
* stop being offered until a provider is configured again.
|
|
35
|
+
*/
|
|
36
|
+
deleteChannel(channel, options = {}) {
|
|
37
|
+
return request({
|
|
38
|
+
method: 'DELETE',
|
|
39
|
+
path: `/v1/messaging_providers/${(0, request_1.enc)(channel)}`,
|
|
40
|
+
...(options.force ? { query: { force: 'true' } } : {}),
|
|
41
|
+
});
|
|
31
42
|
},
|
|
32
43
|
/** Send a fixed, clearly-marked test message through the channel's provider. */
|
|
33
44
|
test(channel, body) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging.js","sourceRoot":"","sources":["../../src/client/messaging.ts"],"names":[],"mappings":";;AAsVA,
|
|
1
|
+
{"version":3,"file":"messaging.js","sourceRoot":"","sources":["../../src/client/messaging.ts"],"names":[],"mappings":";;AAsVA,8CA0DC;AAhZD,uCAAgD;AAsVhD,SAAgB,iBAAiB,CAAC,OAAkB;IAIlD,SAAS,QAAQ,CAAC,IAAa;QAC7B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,+BAA+B,EAAE,IAAI,EAAE,CAAC,CAAC;IACjF,CAAC;IAKD,SAAS,MAAM,CAAC,IAAa;QAC3B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO;QACL,0EAA0E;QAC1E,GAAG;YACD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,yBAAyB,EAAE,CAAC,CAAC;QACrE,CAAC;QACD;;;;WAIG;QACH,QAAQ;QACR;;;;WAIG;QACH,MAAM;QACN;;;;;;WAMG;QACH,aAAa,CACX,OAAwB,EACxB,UAA+B,EAAE;YAEjC,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,2BAA2B,IAAA,aAAG,EAAC,OAAO,CAAC,EAAE;gBAC/C,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACvD,CAAC,CAAC;QACL,CAAC;QACD,gFAAgF;QAChF,IAAI,CAAC,OAAwB,EAAE,IAAoB;YACjD,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,2BAA2B,IAAA,aAAG,EAAC,OAAO,CAAC,OAAO;gBACpD,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/backend",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"jose": "^5.9.6",
|
|
8
|
-
"@atlasauth/
|
|
9
|
-
"@atlasauth/
|
|
8
|
+
"@atlasauth/pca": "0.1.0",
|
|
9
|
+
"@atlasauth/authz": "0.1.1"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"typescript": "^5.6.3",
|