ksef-client-ts 0.1.0 → 0.1.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/README.md +25 -2
- package/dist/cli.js +145 -83
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +122 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -39
- package/dist/index.d.ts +47 -39
- package/dist/index.js +121 -43
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ TypeScript client for the Polish National e-Invoice System (KSeF) API v2.
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **Complete API coverage** — auth, sessions, invoices, permissions, tokens, certificates, QR codes, and more
|
|
9
|
+
- **Complete API coverage** — (KSeF) API v2.3.0 auth, sessions, invoices, permissions, tokens, certificates, QR codes, and more
|
|
10
10
|
- **Full-featured CLI** — `ksef` with many command groups and subcommands for day-to-day KSeF workflows
|
|
11
11
|
- **Full documentation** — VitePress site: Quick Start, API reference, OpenAPI spec
|
|
12
12
|
- **OpenAPI aligned** — types checked against the official KSeF spec; full spec and domain chunks in `docs/`
|
|
@@ -16,7 +16,30 @@ TypeScript client for the Polish National e-Invoice System (KSeF) API v2.
|
|
|
16
16
|
- **Automatic token management** — AuthManager: token injection, 401 refresh with dedup, `loginWithToken` / `loginWithCertificate`
|
|
17
17
|
- **Typed errors & fluent builders** — `KSeFError` hierarchy (401, 403, 429, validation) and request builders
|
|
18
18
|
|
|
19
|
-
Requires **Node.js 18+**.
|
|
19
|
+
Requires **Node.js 18+**.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
Install CLI globally:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm i -g ksef-client-ts
|
|
27
|
+
ksef --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Install in a project:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Choose one package manager:
|
|
34
|
+
# npm
|
|
35
|
+
npm i ksef-client-ts
|
|
36
|
+
# Yarn
|
|
37
|
+
yarn add ksef-client-ts
|
|
38
|
+
# pnpm
|
|
39
|
+
pnpm add ksef-client-ts
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For local development, clone and build:
|
|
20
43
|
|
|
21
44
|
```bash
|
|
22
45
|
git clone https://github.com/Flopsstuff/ksef-client-ts.git
|
package/dist/cli.js
CHANGED
|
@@ -4789,6 +4789,62 @@ var init_signature_service = __esm({
|
|
|
4789
4789
|
}
|
|
4790
4790
|
});
|
|
4791
4791
|
|
|
4792
|
+
// src/crypto/pkcs12-loader.ts
|
|
4793
|
+
var pkcs12_loader_exports = {};
|
|
4794
|
+
__export(pkcs12_loader_exports, {
|
|
4795
|
+
Pkcs12Loader: () => Pkcs12Loader
|
|
4796
|
+
});
|
|
4797
|
+
import forge from "node-forge";
|
|
4798
|
+
var Pkcs12Loader;
|
|
4799
|
+
var init_pkcs12_loader = __esm({
|
|
4800
|
+
"src/crypto/pkcs12-loader.ts"() {
|
|
4801
|
+
"use strict";
|
|
4802
|
+
Pkcs12Loader = class {
|
|
4803
|
+
static load(p12, password) {
|
|
4804
|
+
const { pki, pkcs12, asn1 } = forge;
|
|
4805
|
+
const p12Der = Buffer.from(p12).toString("binary");
|
|
4806
|
+
const p12Asn1 = asn1.fromDer(p12Der);
|
|
4807
|
+
const p12Parsed = pkcs12.pkcs12FromAsn1(p12Asn1, password);
|
|
4808
|
+
const certBagType = pki.oids.certBag;
|
|
4809
|
+
const certBags = p12Parsed.getBags({ bagType: certBagType });
|
|
4810
|
+
const certs = certBags[certBagType];
|
|
4811
|
+
if (!certs || certs.length === 0) {
|
|
4812
|
+
throw new Error("PKCS#12 file does not contain a certificate.");
|
|
4813
|
+
}
|
|
4814
|
+
const shroudedType = pki.oids.pkcs8ShroudedKeyBag;
|
|
4815
|
+
let keyBags = p12Parsed.getBags({ bagType: shroudedType });
|
|
4816
|
+
let keys = keyBags[shroudedType];
|
|
4817
|
+
if (!keys || keys.length === 0) {
|
|
4818
|
+
const plainType = pki.oids.keyBag;
|
|
4819
|
+
keyBags = p12Parsed.getBags({ bagType: plainType });
|
|
4820
|
+
keys = keyBags[plainType];
|
|
4821
|
+
}
|
|
4822
|
+
if (!keys || keys.length === 0) {
|
|
4823
|
+
throw new Error("PKCS#12 file does not contain a private key.");
|
|
4824
|
+
}
|
|
4825
|
+
const cert = certs[0].cert;
|
|
4826
|
+
const key = keys[0].key;
|
|
4827
|
+
if (!cert) {
|
|
4828
|
+
throw new Error("PKCS#12 certificate bag is empty.");
|
|
4829
|
+
}
|
|
4830
|
+
if (!key) {
|
|
4831
|
+
throw new Error("PKCS#12 key bag is empty.");
|
|
4832
|
+
}
|
|
4833
|
+
const certificatePem = pki.certificateToPem(cert);
|
|
4834
|
+
let privateKeyPem;
|
|
4835
|
+
try {
|
|
4836
|
+
privateKeyPem = pki.privateKeyToPem(key);
|
|
4837
|
+
} catch {
|
|
4838
|
+
throw new Error(
|
|
4839
|
+
"Failed to export private key from PKCS#12 to PEM. This can happen with EC keys. Use separate --cert and --key PEM files instead."
|
|
4840
|
+
);
|
|
4841
|
+
}
|
|
4842
|
+
return { certificatePem, privateKeyPem };
|
|
4843
|
+
}
|
|
4844
|
+
};
|
|
4845
|
+
}
|
|
4846
|
+
});
|
|
4847
|
+
|
|
4792
4848
|
// src/cli/index.ts
|
|
4793
4849
|
import { defineCommand as defineCommand15, runMain } from "citty";
|
|
4794
4850
|
|
|
@@ -4804,7 +4860,7 @@ import * as os from "os";
|
|
|
4804
4860
|
var ENV_MAP = {
|
|
4805
4861
|
test: "TEST",
|
|
4806
4862
|
demo: "DEMO",
|
|
4807
|
-
prod: "
|
|
4863
|
+
prod: "PROD"
|
|
4808
4864
|
};
|
|
4809
4865
|
function toEnvironmentName(env) {
|
|
4810
4866
|
return ENV_MAP[env];
|
|
@@ -5105,7 +5161,7 @@ var Environment = {
|
|
|
5105
5161
|
qrUrl: "https://qr-demo.ksef.mf.gov.pl",
|
|
5106
5162
|
lighthouseUrl: ""
|
|
5107
5163
|
},
|
|
5108
|
-
|
|
5164
|
+
PROD: {
|
|
5109
5165
|
apiUrl: "https://api.ksef.mf.gov.pl",
|
|
5110
5166
|
qrUrl: "https://qr.ksef.mf.gov.pl",
|
|
5111
5167
|
lighthouseUrl: "https://api-latarnia.ksef.mf.gov.pl"
|
|
@@ -5313,6 +5369,10 @@ var RestClient = class {
|
|
|
5313
5369
|
const body = await response.json();
|
|
5314
5370
|
return { body, headers: response.headers, statusCode: response.status };
|
|
5315
5371
|
}
|
|
5372
|
+
async executeVoid(request) {
|
|
5373
|
+
const response = await this.sendRequest(request);
|
|
5374
|
+
await this.ensureSuccess(response);
|
|
5375
|
+
}
|
|
5316
5376
|
async executeRaw(request) {
|
|
5317
5377
|
const response = await this.sendRequest(request);
|
|
5318
5378
|
await this.ensureSuccess(response);
|
|
@@ -5776,11 +5836,11 @@ var ActiveSessionsService = class {
|
|
|
5776
5836
|
}
|
|
5777
5837
|
async revokeCurrentSession() {
|
|
5778
5838
|
const request = RestRequest.delete(Routes.ActiveSessions.currentSession);
|
|
5779
|
-
await this.restClient.
|
|
5839
|
+
await this.restClient.executeVoid(request);
|
|
5780
5840
|
}
|
|
5781
5841
|
async revokeSession(sessionRef) {
|
|
5782
5842
|
const request = RestRequest.delete(Routes.ActiveSessions.delete(sessionRef));
|
|
5783
|
-
await this.restClient.
|
|
5843
|
+
await this.restClient.executeVoid(request);
|
|
5784
5844
|
}
|
|
5785
5845
|
};
|
|
5786
5846
|
|
|
@@ -5805,7 +5865,7 @@ var OnlineSessionService = class {
|
|
|
5805
5865
|
}
|
|
5806
5866
|
async closeSession(sessionRef) {
|
|
5807
5867
|
const req = RestRequest.post(Routes.Sessions.Online.close(sessionRef));
|
|
5808
|
-
await this.restClient.
|
|
5868
|
+
await this.restClient.executeVoid(req);
|
|
5809
5869
|
}
|
|
5810
5870
|
};
|
|
5811
5871
|
|
|
@@ -5846,7 +5906,7 @@ var BatchSessionService = class {
|
|
|
5846
5906
|
}
|
|
5847
5907
|
async closeSession(batchRef) {
|
|
5848
5908
|
const req = RestRequest.post(Routes.Sessions.Batch.close(batchRef));
|
|
5849
|
-
await this.restClient.
|
|
5909
|
+
await this.restClient.executeVoid(req);
|
|
5850
5910
|
}
|
|
5851
5911
|
};
|
|
5852
5912
|
|
|
@@ -6119,7 +6179,7 @@ var TokenService = class {
|
|
|
6119
6179
|
}
|
|
6120
6180
|
async revokeToken(ref) {
|
|
6121
6181
|
const req = RestRequest.delete(Routes.Tokens.byReference(ref));
|
|
6122
|
-
await this.restClient.
|
|
6182
|
+
await this.restClient.executeVoid(req);
|
|
6123
6183
|
}
|
|
6124
6184
|
};
|
|
6125
6185
|
|
|
@@ -6156,7 +6216,7 @@ var CertificateApiService = class {
|
|
|
6156
6216
|
}
|
|
6157
6217
|
async revoke(serialNumber, request) {
|
|
6158
6218
|
const req = RestRequest.post(Routes.Certificates.revoke(serialNumber)).body(request);
|
|
6159
|
-
await this.restClient.
|
|
6219
|
+
await this.restClient.executeVoid(req);
|
|
6160
6220
|
}
|
|
6161
6221
|
async query(request, pageSize, pageOffset) {
|
|
6162
6222
|
const req = RestRequest.post(Routes.Certificates.query).body(request);
|
|
@@ -6249,95 +6309,78 @@ var TestDataService = class {
|
|
|
6249
6309
|
// Subject management
|
|
6250
6310
|
async createSubject(request) {
|
|
6251
6311
|
const req = RestRequest.post(Routes.TestData.createSubject).body(request);
|
|
6252
|
-
|
|
6253
|
-
return response.body;
|
|
6312
|
+
await this.restClient.executeVoid(req);
|
|
6254
6313
|
}
|
|
6255
6314
|
async removeSubject(request) {
|
|
6256
6315
|
const req = RestRequest.post(Routes.TestData.removeSubject).body(request);
|
|
6257
|
-
|
|
6258
|
-
return response.body;
|
|
6316
|
+
await this.restClient.executeVoid(req);
|
|
6259
6317
|
}
|
|
6260
6318
|
// Person management
|
|
6261
6319
|
async createPerson(request) {
|
|
6262
6320
|
const req = RestRequest.post(Routes.TestData.createPerson).body(request);
|
|
6263
|
-
|
|
6264
|
-
return response.body;
|
|
6321
|
+
await this.restClient.executeVoid(req);
|
|
6265
6322
|
}
|
|
6266
6323
|
async removePerson(request) {
|
|
6267
6324
|
const req = RestRequest.post(Routes.TestData.removePerson).body(request);
|
|
6268
|
-
|
|
6269
|
-
return response.body;
|
|
6325
|
+
await this.restClient.executeVoid(req);
|
|
6270
6326
|
}
|
|
6271
6327
|
// Permissions
|
|
6272
6328
|
async grantPermissions(request) {
|
|
6273
6329
|
const req = RestRequest.post(Routes.TestData.grantPerms).body(request);
|
|
6274
|
-
|
|
6275
|
-
return response.body;
|
|
6330
|
+
await this.restClient.executeVoid(req);
|
|
6276
6331
|
}
|
|
6277
6332
|
async revokePermissions(request) {
|
|
6278
6333
|
const req = RestRequest.post(Routes.TestData.revokePerms).body(request);
|
|
6279
|
-
|
|
6280
|
-
return response.body;
|
|
6334
|
+
await this.restClient.executeVoid(req);
|
|
6281
6335
|
}
|
|
6282
6336
|
// Attachment permissions
|
|
6283
6337
|
async enableAttachment(request) {
|
|
6284
6338
|
const req = RestRequest.post(Routes.TestData.enableAttach).body(request);
|
|
6285
|
-
|
|
6286
|
-
return response.body;
|
|
6339
|
+
await this.restClient.executeVoid(req);
|
|
6287
6340
|
}
|
|
6288
6341
|
async disableAttachment(request) {
|
|
6289
6342
|
const req = RestRequest.post(Routes.TestData.disableAttach).body(request);
|
|
6290
|
-
|
|
6291
|
-
return response.body;
|
|
6343
|
+
await this.restClient.executeVoid(req);
|
|
6292
6344
|
}
|
|
6293
6345
|
// Session limits
|
|
6294
6346
|
async changeSessionLimits(request) {
|
|
6295
6347
|
const req = RestRequest.post(Routes.TestData.changeSessionLimitsInCurrentContext).body(request);
|
|
6296
|
-
|
|
6297
|
-
return response.body;
|
|
6348
|
+
await this.restClient.executeVoid(req);
|
|
6298
6349
|
}
|
|
6299
6350
|
async restoreDefaultSessionLimits() {
|
|
6300
6351
|
const req = RestRequest.delete(Routes.TestData.restoreDefaultSessionLimitsInCurrentContext);
|
|
6301
|
-
|
|
6302
|
-
return response.body;
|
|
6352
|
+
await this.restClient.executeVoid(req);
|
|
6303
6353
|
}
|
|
6304
6354
|
// Certificate limits
|
|
6305
6355
|
async changeCertificatesLimit(request) {
|
|
6306
6356
|
const req = RestRequest.post(Routes.TestData.changeCertificatesLimitInCurrentSubject).body(request);
|
|
6307
|
-
|
|
6308
|
-
return response.body;
|
|
6357
|
+
await this.restClient.executeVoid(req);
|
|
6309
6358
|
}
|
|
6310
6359
|
async restoreDefaultCertificatesLimit() {
|
|
6311
6360
|
const req = RestRequest.delete(Routes.TestData.restoreDefaultCertificatesLimitInCurrentSubject);
|
|
6312
|
-
|
|
6313
|
-
return response.body;
|
|
6361
|
+
await this.restClient.executeVoid(req);
|
|
6314
6362
|
}
|
|
6315
6363
|
// Rate limits
|
|
6316
6364
|
async setRateLimits(request) {
|
|
6317
6365
|
const req = RestRequest.post(Routes.TestData.rateLimits).body(request);
|
|
6318
|
-
|
|
6319
|
-
return response.body;
|
|
6366
|
+
await this.restClient.executeVoid(req);
|
|
6320
6367
|
}
|
|
6321
6368
|
async restoreDefaultRateLimits() {
|
|
6322
6369
|
const req = RestRequest.delete(Routes.TestData.rateLimits);
|
|
6323
|
-
|
|
6324
|
-
return response.body;
|
|
6370
|
+
await this.restClient.executeVoid(req);
|
|
6325
6371
|
}
|
|
6326
6372
|
async setProductionRateLimits() {
|
|
6327
6373
|
const req = RestRequest.post(Routes.TestData.productionRateLimits);
|
|
6328
|
-
|
|
6329
|
-
return response.body;
|
|
6374
|
+
await this.restClient.executeVoid(req);
|
|
6330
6375
|
}
|
|
6331
6376
|
// Context blocking
|
|
6332
6377
|
async blockContext(request) {
|
|
6333
6378
|
const req = RestRequest.post(Routes.TestData.blockContext).body(request);
|
|
6334
|
-
|
|
6335
|
-
return response.body;
|
|
6379
|
+
await this.restClient.executeVoid(req);
|
|
6336
6380
|
}
|
|
6337
6381
|
async unblockContext(request) {
|
|
6338
6382
|
const req = RestRequest.post(Routes.TestData.unblockContext).body(request);
|
|
6339
|
-
|
|
6340
|
-
return response.body;
|
|
6383
|
+
await this.restClient.executeVoid(req);
|
|
6341
6384
|
}
|
|
6342
6385
|
};
|
|
6343
6386
|
|
|
@@ -6725,6 +6768,7 @@ var KSeFClient = class {
|
|
|
6725
6768
|
encryptedToken: Buffer.from(encryptedToken).toString("base64")
|
|
6726
6769
|
});
|
|
6727
6770
|
const authToken = submitResult.authenticationToken.token;
|
|
6771
|
+
await this.awaitAuthReady(submitResult.referenceNumber, authToken);
|
|
6728
6772
|
const tokens = await this.auth.getAccessToken(authToken);
|
|
6729
6773
|
this.authManager.setAccessToken(tokens.accessToken.token);
|
|
6730
6774
|
this.authManager.setRefreshToken(tokens.refreshToken.token);
|
|
@@ -6736,10 +6780,26 @@ var KSeFClient = class {
|
|
|
6736
6780
|
const signedXml = SignatureService2.sign(authRequestXml, certPem, keyPem);
|
|
6737
6781
|
const submitResult = await this.auth.submitXadesAuthRequest(signedXml);
|
|
6738
6782
|
const authToken = submitResult.authenticationToken.token;
|
|
6783
|
+
await this.awaitAuthReady(submitResult.referenceNumber, authToken);
|
|
6739
6784
|
const tokens = await this.auth.getAccessToken(authToken);
|
|
6740
6785
|
this.authManager.setAccessToken(tokens.accessToken.token);
|
|
6741
6786
|
this.authManager.setRefreshToken(tokens.refreshToken.token);
|
|
6742
6787
|
}
|
|
6788
|
+
async loginWithPkcs12(p12, password, nip) {
|
|
6789
|
+
const { Pkcs12Loader: Pkcs12Loader2 } = await Promise.resolve().then(() => (init_pkcs12_loader(), pkcs12_loader_exports));
|
|
6790
|
+
const { certificatePem, privateKeyPem } = Pkcs12Loader2.load(p12, password);
|
|
6791
|
+
await this.loginWithCertificate(certificatePem, privateKeyPem, nip);
|
|
6792
|
+
}
|
|
6793
|
+
async awaitAuthReady(referenceNumber, authToken) {
|
|
6794
|
+
for (let i = 0; i < 30; i++) {
|
|
6795
|
+
const status6 = await this.auth.getAuthStatus(referenceNumber, authToken);
|
|
6796
|
+
if (status6.status.code === 200) return;
|
|
6797
|
+
if (status6.status.code !== 100) {
|
|
6798
|
+
throw new Error(`Authentication failed with status ${status6.status.code}: ${status6.status.description}`);
|
|
6799
|
+
}
|
|
6800
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
6801
|
+
}
|
|
6802
|
+
}
|
|
6743
6803
|
async logout() {
|
|
6744
6804
|
this.authManager.setAccessToken(void 0);
|
|
6745
6805
|
this.authManager.setRefreshToken(void 0);
|
|
@@ -6901,6 +6961,8 @@ var login = defineCommand2({
|
|
|
6901
6961
|
token: { type: "string", description: "KSeF authorization token" },
|
|
6902
6962
|
cert: { type: "string", description: "Path to PEM certificate file (XAdES auth)" },
|
|
6903
6963
|
key: { type: "string", description: "Path to PEM private key file (XAdES auth)" },
|
|
6964
|
+
p12: { type: "string", description: "Path to PKCS#12 (.p12/.pfx) certificate file" },
|
|
6965
|
+
"p12-password": { type: "string", description: "Password for the PKCS#12 file (default: empty)" },
|
|
6904
6966
|
env: { type: "string", description: "Environment (test/demo/prod)" },
|
|
6905
6967
|
json: { type: "boolean", description: "Output as JSON" },
|
|
6906
6968
|
verbose: { type: "boolean", description: "Show HTTP request/response details" },
|
|
@@ -6918,13 +6980,17 @@ var login = defineCommand2({
|
|
|
6918
6980
|
}
|
|
6919
6981
|
if (args.token) {
|
|
6920
6982
|
await client.loginWithToken(args.token, nip);
|
|
6983
|
+
} else if (args.p12) {
|
|
6984
|
+
const fs7 = await import("fs");
|
|
6985
|
+
const p12Buffer = fs7.readFileSync(args.p12);
|
|
6986
|
+
await client.loginWithPkcs12(p12Buffer, args["p12-password"] ?? "", nip);
|
|
6921
6987
|
} else if (args.cert && args.key) {
|
|
6922
6988
|
const fs7 = await import("fs");
|
|
6923
6989
|
const certPem = fs7.readFileSync(args.cert, "utf-8");
|
|
6924
6990
|
const keyPem = fs7.readFileSync(args.key, "utf-8");
|
|
6925
6991
|
await client.loginWithCertificate(certPem, keyPem, nip);
|
|
6926
6992
|
} else {
|
|
6927
|
-
throw new Error("Provide --token or both --cert and --key for authentication.");
|
|
6993
|
+
throw new Error("Provide --token, --p12, or both --cert and --key for authentication.");
|
|
6928
6994
|
}
|
|
6929
6995
|
const session = {
|
|
6930
6996
|
accessToken: client.authManager.getAccessToken(),
|
|
@@ -9221,15 +9287,11 @@ function requireNonProd(globalOpts) {
|
|
|
9221
9287
|
throw new Error("Test data commands are only available in test/demo environments.");
|
|
9222
9288
|
}
|
|
9223
9289
|
}
|
|
9224
|
-
function
|
|
9290
|
+
function outputDone(json) {
|
|
9225
9291
|
if (json) {
|
|
9226
|
-
outputResult(
|
|
9292
|
+
outputResult({ status: "ok" }, { json: true });
|
|
9227
9293
|
} else {
|
|
9228
9294
|
outputSuccess("Done.");
|
|
9229
|
-
outputKeyValue({
|
|
9230
|
-
"Code": result.code,
|
|
9231
|
-
"Description": result.description
|
|
9232
|
-
}, { json: false });
|
|
9233
9295
|
}
|
|
9234
9296
|
}
|
|
9235
9297
|
var createSubject = defineCommand10({
|
|
@@ -9254,8 +9316,8 @@ var createSubject = defineCommand10({
|
|
|
9254
9316
|
description: args.description,
|
|
9255
9317
|
createdDate: args["created-date"]
|
|
9256
9318
|
};
|
|
9257
|
-
|
|
9258
|
-
|
|
9319
|
+
await createClient(globalOpts).testData.createSubject(request);
|
|
9320
|
+
outputDone(args.json);
|
|
9259
9321
|
});
|
|
9260
9322
|
}
|
|
9261
9323
|
});
|
|
@@ -9273,8 +9335,8 @@ var removeSubject = defineCommand10({
|
|
|
9273
9335
|
const globalOpts = getGlobalOpts9(args);
|
|
9274
9336
|
requireNonProd(globalOpts);
|
|
9275
9337
|
const request = { subjectNip: args.nip };
|
|
9276
|
-
|
|
9277
|
-
|
|
9338
|
+
await createClient(globalOpts).testData.removeSubject(request);
|
|
9339
|
+
outputDone(args.json);
|
|
9278
9340
|
});
|
|
9279
9341
|
}
|
|
9280
9342
|
});
|
|
@@ -9304,8 +9366,8 @@ var createPerson = defineCommand10({
|
|
|
9304
9366
|
isDeceased: args.deceased,
|
|
9305
9367
|
createdDate: args["created-date"]
|
|
9306
9368
|
};
|
|
9307
|
-
|
|
9308
|
-
|
|
9369
|
+
await createClient(globalOpts).testData.createPerson(request);
|
|
9370
|
+
outputDone(args.json);
|
|
9309
9371
|
});
|
|
9310
9372
|
}
|
|
9311
9373
|
});
|
|
@@ -9323,8 +9385,8 @@ var removePerson = defineCommand10({
|
|
|
9323
9385
|
const globalOpts = getGlobalOpts9(args);
|
|
9324
9386
|
requireNonProd(globalOpts);
|
|
9325
9387
|
const request = { nip: args.nip };
|
|
9326
|
-
|
|
9327
|
-
|
|
9388
|
+
await createClient(globalOpts).testData.removePerson(request);
|
|
9389
|
+
outputDone(args.json);
|
|
9328
9390
|
});
|
|
9329
9391
|
}
|
|
9330
9392
|
});
|
|
@@ -9354,8 +9416,8 @@ var grantPermissions = defineCommand10({
|
|
|
9354
9416
|
},
|
|
9355
9417
|
permissions
|
|
9356
9418
|
};
|
|
9357
|
-
|
|
9358
|
-
|
|
9419
|
+
await createClient(globalOpts).testData.grantPermissions(request);
|
|
9420
|
+
outputDone(args.json);
|
|
9359
9421
|
});
|
|
9360
9422
|
}
|
|
9361
9423
|
});
|
|
@@ -9382,8 +9444,8 @@ var revokePermissions = defineCommand10({
|
|
|
9382
9444
|
value: args.identifier
|
|
9383
9445
|
}
|
|
9384
9446
|
};
|
|
9385
|
-
|
|
9386
|
-
|
|
9447
|
+
await createClient(globalOpts).testData.revokePermissions(request);
|
|
9448
|
+
outputDone(args.json);
|
|
9387
9449
|
});
|
|
9388
9450
|
}
|
|
9389
9451
|
});
|
|
@@ -9401,8 +9463,8 @@ var enableAttachment = defineCommand10({
|
|
|
9401
9463
|
const globalOpts = getGlobalOpts9(args);
|
|
9402
9464
|
requireNonProd(globalOpts);
|
|
9403
9465
|
const request = { nip: args.nip };
|
|
9404
|
-
|
|
9405
|
-
|
|
9466
|
+
await createClient(globalOpts).testData.enableAttachment(request);
|
|
9467
|
+
outputDone(args.json);
|
|
9406
9468
|
});
|
|
9407
9469
|
}
|
|
9408
9470
|
});
|
|
@@ -9424,8 +9486,8 @@ var disableAttachment = defineCommand10({
|
|
|
9424
9486
|
nip: args.nip,
|
|
9425
9487
|
expectedEndDate: args["end-date"]
|
|
9426
9488
|
};
|
|
9427
|
-
|
|
9428
|
-
|
|
9489
|
+
await createClient(globalOpts).testData.disableAttachment(request);
|
|
9490
|
+
outputDone(args.json);
|
|
9429
9491
|
});
|
|
9430
9492
|
}
|
|
9431
9493
|
});
|
|
@@ -9461,8 +9523,8 @@ var changeSessionLimits = defineCommand10({
|
|
|
9461
9523
|
maxInvoices: parseInt(args["batch-max-invoices"], 10)
|
|
9462
9524
|
}
|
|
9463
9525
|
};
|
|
9464
|
-
|
|
9465
|
-
|
|
9526
|
+
await client.testData.changeSessionLimits(request);
|
|
9527
|
+
outputDone(args.json);
|
|
9466
9528
|
});
|
|
9467
9529
|
}
|
|
9468
9530
|
});
|
|
@@ -9480,8 +9542,8 @@ var restoreSessionLimits = defineCommand10({
|
|
|
9480
9542
|
const globalOpts = getGlobalOpts9(args);
|
|
9481
9543
|
requireNonProd(globalOpts);
|
|
9482
9544
|
const { client } = requireSession(globalOpts);
|
|
9483
|
-
|
|
9484
|
-
|
|
9545
|
+
await client.testData.restoreDefaultSessionLimits();
|
|
9546
|
+
outputDone(args.json);
|
|
9485
9547
|
});
|
|
9486
9548
|
}
|
|
9487
9549
|
});
|
|
@@ -9507,8 +9569,8 @@ var changeCertLimits = defineCommand10({
|
|
|
9507
9569
|
enrollment: args["max-enrollments"] !== void 0 ? { maxEnrollments: parseInt(args["max-enrollments"], 10) } : void 0,
|
|
9508
9570
|
certificate: args["max-certificates"] !== void 0 ? { maxCertificates: parseInt(args["max-certificates"], 10) } : void 0
|
|
9509
9571
|
};
|
|
9510
|
-
|
|
9511
|
-
|
|
9572
|
+
await client.testData.changeCertificatesLimit(request);
|
|
9573
|
+
outputDone(args.json);
|
|
9512
9574
|
});
|
|
9513
9575
|
}
|
|
9514
9576
|
});
|
|
@@ -9526,8 +9588,8 @@ var restoreCertLimits = defineCommand10({
|
|
|
9526
9588
|
const globalOpts = getGlobalOpts9(args);
|
|
9527
9589
|
requireNonProd(globalOpts);
|
|
9528
9590
|
const { client } = requireSession(globalOpts);
|
|
9529
|
-
|
|
9530
|
-
|
|
9591
|
+
await client.testData.restoreDefaultCertificatesLimit();
|
|
9592
|
+
outputDone(args.json);
|
|
9531
9593
|
});
|
|
9532
9594
|
}
|
|
9533
9595
|
});
|
|
@@ -9549,8 +9611,8 @@ var setRateLimits = defineCommand10({
|
|
|
9549
9611
|
const request = {
|
|
9550
9612
|
rateLimits: JSON.parse(args.limits)
|
|
9551
9613
|
};
|
|
9552
|
-
|
|
9553
|
-
|
|
9614
|
+
await client.testData.setRateLimits(request);
|
|
9615
|
+
outputDone(args.json);
|
|
9554
9616
|
});
|
|
9555
9617
|
}
|
|
9556
9618
|
});
|
|
@@ -9568,8 +9630,8 @@ var restoreRateLimits = defineCommand10({
|
|
|
9568
9630
|
const globalOpts = getGlobalOpts9(args);
|
|
9569
9631
|
requireNonProd(globalOpts);
|
|
9570
9632
|
const { client } = requireSession(globalOpts);
|
|
9571
|
-
|
|
9572
|
-
|
|
9633
|
+
await client.testData.restoreDefaultRateLimits();
|
|
9634
|
+
outputDone(args.json);
|
|
9573
9635
|
});
|
|
9574
9636
|
}
|
|
9575
9637
|
});
|
|
@@ -9587,8 +9649,8 @@ var setProductionRateLimits = defineCommand10({
|
|
|
9587
9649
|
const globalOpts = getGlobalOpts9(args);
|
|
9588
9650
|
requireNonProd(globalOpts);
|
|
9589
9651
|
const { client } = requireSession(globalOpts);
|
|
9590
|
-
|
|
9591
|
-
|
|
9652
|
+
await client.testData.setProductionRateLimits();
|
|
9653
|
+
outputDone(args.json);
|
|
9592
9654
|
});
|
|
9593
9655
|
}
|
|
9594
9656
|
});
|
|
@@ -9614,8 +9676,8 @@ var blockContext = defineCommand10({
|
|
|
9614
9676
|
value: args["context-value"]
|
|
9615
9677
|
}
|
|
9616
9678
|
};
|
|
9617
|
-
|
|
9618
|
-
|
|
9679
|
+
await client.testData.blockContext(request);
|
|
9680
|
+
outputDone(args.json);
|
|
9619
9681
|
});
|
|
9620
9682
|
}
|
|
9621
9683
|
});
|
|
@@ -9641,8 +9703,8 @@ var unblockContext = defineCommand10({
|
|
|
9641
9703
|
value: args["context-value"]
|
|
9642
9704
|
}
|
|
9643
9705
|
};
|
|
9644
|
-
|
|
9645
|
-
|
|
9706
|
+
await client.testData.unblockContext(request);
|
|
9707
|
+
outputDone(args.json);
|
|
9646
9708
|
});
|
|
9647
9709
|
}
|
|
9648
9710
|
});
|