@piparotech/subkit-node 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +52 -0
  3. package/dist/AccessClient.d.ts +173 -0
  4. package/dist/AccessClient.d.ts.map +1 -0
  5. package/dist/AccessClient.js +140 -0
  6. package/dist/AccessClient.js.map +1 -0
  7. package/dist/ContractsClient.d.ts +48 -0
  8. package/dist/ContractsClient.d.ts.map +1 -0
  9. package/dist/ContractsClient.js +51 -0
  10. package/dist/ContractsClient.js.map +1 -0
  11. package/dist/CustomersClient.d.ts +88 -0
  12. package/dist/CustomersClient.d.ts.map +1 -0
  13. package/dist/CustomersClient.js +82 -0
  14. package/dist/CustomersClient.js.map +1 -0
  15. package/dist/DevicesClient.d.ts +56 -0
  16. package/dist/DevicesClient.d.ts.map +1 -0
  17. package/dist/DevicesClient.js +52 -0
  18. package/dist/DevicesClient.js.map +1 -0
  19. package/dist/EntitlementsClient.d.ts +17 -0
  20. package/dist/EntitlementsClient.d.ts.map +1 -0
  21. package/dist/EntitlementsClient.js +30 -0
  22. package/dist/EntitlementsClient.js.map +1 -0
  23. package/dist/HttpClient.d.ts +36 -0
  24. package/dist/HttpClient.d.ts.map +1 -0
  25. package/dist/HttpClient.js +166 -0
  26. package/dist/HttpClient.js.map +1 -0
  27. package/dist/LicensesClient.d.ts +105 -0
  28. package/dist/LicensesClient.d.ts.map +1 -0
  29. package/dist/LicensesClient.js +97 -0
  30. package/dist/LicensesClient.js.map +1 -0
  31. package/dist/OfferingsClient.d.ts +17 -0
  32. package/dist/OfferingsClient.d.ts.map +1 -0
  33. package/dist/OfferingsClient.js +27 -0
  34. package/dist/OfferingsClient.js.map +1 -0
  35. package/dist/PaymentsClient.d.ts +58 -0
  36. package/dist/PaymentsClient.d.ts.map +1 -0
  37. package/dist/PaymentsClient.js +41 -0
  38. package/dist/PaymentsClient.js.map +1 -0
  39. package/dist/ProductsClient.d.ts +32 -0
  40. package/dist/ProductsClient.d.ts.map +1 -0
  41. package/dist/ProductsClient.js +40 -0
  42. package/dist/ProductsClient.js.map +1 -0
  43. package/dist/SubKit.d.ts +36 -0
  44. package/dist/SubKit.d.ts.map +1 -0
  45. package/dist/SubKit.js +41 -0
  46. package/dist/SubKit.js.map +1 -0
  47. package/dist/errors.d.ts +16 -0
  48. package/dist/errors.d.ts.map +1 -0
  49. package/dist/errors.js +18 -0
  50. package/dist/errors.js.map +1 -0
  51. package/dist/index.d.ts +14 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +3 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/requestOptions.d.ts +9 -0
  56. package/dist/requestOptions.d.ts.map +1 -0
  57. package/dist/requestOptions.js +2 -0
  58. package/dist/requestOptions.js.map +1 -0
  59. package/package.json +47 -0
@@ -0,0 +1,97 @@
1
+ import { z } from 'zod';
2
+ import { serverContractPlanVersionsResponseSchema, serverLicenseDetailResponseSchema, serverLicenseListResponseSchema, } from '@piparotech/subkit-core';
3
+ const contractLifecycleActionSchema = z.enum([
4
+ 'renew',
5
+ 'resume',
6
+ 'revert_non_renewal',
7
+ 'revoke',
8
+ 'schedule_non_renewal',
9
+ 'suspend',
10
+ ]);
11
+ const contractLifecyclePreviewSchema = z.object({
12
+ action: contractLifecycleActionSchema,
13
+ affectedAllocationCount: z.number(),
14
+ affectedEntitlements: z.array(z.string()),
15
+ afterAutoRenews: z.boolean(),
16
+ afterState: z.string(),
17
+ afterTermEnd: z.string().nullable(),
18
+ beforeAutoRenews: z.boolean(),
19
+ beforeState: z.string(),
20
+ beforeTermEnd: z.string().nullable(),
21
+ contractNumber: z.string().nullable(),
22
+ externalContractId: z.string(),
23
+ sourceId: z.string(),
24
+ warnings: z.array(z.string()),
25
+ });
26
+ const contractLifecycleApplySchema = contractLifecyclePreviewSchema.extend({ ok: z.literal(true) });
27
+ export class LicensesClient {
28
+ appId;
29
+ http;
30
+ constructor(options) {
31
+ this.appId = options.appId;
32
+ this.http = options.http;
33
+ }
34
+ list(input = {}, options = {}) {
35
+ return this.http.post('/api/server/licenses', {
36
+ ...options,
37
+ body: {
38
+ appId: resolveAppId(input.appId, this.appId),
39
+ cursor: input.cursor,
40
+ kind: input.kind,
41
+ limit: input.limit,
42
+ query: input.query,
43
+ state: input.state,
44
+ },
45
+ responseSchema: serverLicenseListResponseSchema,
46
+ });
47
+ }
48
+ get(input, options = {}) {
49
+ const appId = resolveAppId(input.appId, this.appId);
50
+ const query = new URLSearchParams({ appId }).toString();
51
+ return this.http.get(`/api/server/licenses/${encodeURIComponent(input.sourceId)}?${query}`, {
52
+ ...options,
53
+ responseSchema: serverLicenseDetailResponseSchema,
54
+ });
55
+ }
56
+ contractPlanVersions(input = {}, options = {}) {
57
+ return this.http.post('/api/server/contract-plan-versions', {
58
+ ...options,
59
+ body: { appId: resolveAppId(input.appId, this.appId) },
60
+ responseSchema: serverContractPlanVersionsResponseSchema,
61
+ });
62
+ }
63
+ previewContractLifecycle(input, options = {}) {
64
+ return this.http.post(`/api/server/contracts/${encodeURIComponent(input.sourceId)}/lifecycle`, {
65
+ ...options,
66
+ body: {
67
+ action: input.action,
68
+ appId: resolveAppId(input.appId, this.appId),
69
+ newTermEnd: input.newTermEnd?.toISOString(),
70
+ },
71
+ responseSchema: contractLifecyclePreviewSchema,
72
+ });
73
+ }
74
+ applyContractLifecycle(input, options) {
75
+ return this.http.patch(`/api/server/contracts/${encodeURIComponent(input.sourceId)}/lifecycle`, {
76
+ ...options,
77
+ body: {
78
+ action: input.action,
79
+ appId: resolveAppId(input.appId, this.appId),
80
+ expectedAutoRenews: input.expectedAutoRenews,
81
+ expectedState: input.expectedState,
82
+ expectedTermEnd: input.expectedTermEnd?.toISOString() ?? input.expectedTermEnd,
83
+ newTermEnd: input.newTermEnd?.toISOString(),
84
+ reason: input.reason,
85
+ },
86
+ responseSchema: contractLifecycleApplySchema,
87
+ });
88
+ }
89
+ }
90
+ function resolveAppId(inputAppId, defaultAppId) {
91
+ const appId = inputAppId ?? defaultAppId;
92
+ if (appId == null || appId.trim() === '') {
93
+ throw new Error('SubKit appId is required. Pass appId to the client or to this request.');
94
+ }
95
+ return appId;
96
+ }
97
+ //# sourceMappingURL=LicensesClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LicensesClient.js","sourceRoot":"","sources":["../src/LicensesClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAKL,wCAAwC,EACxC,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,yBAAyB,CAAA;AAKhC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3C,OAAO;IACP,QAAQ;IACR,oBAAoB;IACpB,QAAQ;IACR,sBAAsB;IACtB,SAAS;CACV,CAAC,CAAA;AACF,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,6BAA6B;IACrC,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE;IACnC,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACzC,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC7B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC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,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE;gBAC3C,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB;YACD,cAAc,EAAE,4BAA4B;SAC7C,CACF,CAAA;IACH,CAAC;CACF;AAED,SAAS,YAAY,CAAC,UAA8B,EAAE,YAAgC;IACpF,MAAM,KAAK,GAAG,UAAU,IAAI,YAAY,CAAA;IACxC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type RuntimeOfferingsResponse, type ServerOfferingsRequest } from '@piparotech/subkit-core';
2
+ import type { HttpClient } from './HttpClient.js';
3
+ import type { SubKitRequestOptions } from './requestOptions.js';
4
+ interface OfferingsClientOptions {
5
+ appId: string | undefined;
6
+ http: HttpClient;
7
+ }
8
+ export declare class OfferingsClient {
9
+ private readonly appId;
10
+ private readonly http;
11
+ constructor(options: OfferingsClientOptions);
12
+ list(input?: Omit<ServerOfferingsRequest, 'appId'> & {
13
+ appId?: string;
14
+ }, options?: SubKitRequestOptions): Promise<RuntimeOfferingsResponse>;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=OfferingsClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OfferingsClient.d.ts","sourceRoot":"","sources":["../src/OfferingsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAE5B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,OAAO,EAAE,sBAAsB;IAK3C,IAAI,CACF,KAAK,GAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,EACtE,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC;CAUrC"}
@@ -0,0 +1,27 @@
1
+ import { runtimeOfferingsResponseSchema, } from '@piparotech/subkit-core';
2
+ export class OfferingsClient {
3
+ appId;
4
+ http;
5
+ constructor(options) {
6
+ this.appId = options.appId;
7
+ this.http = options.http;
8
+ }
9
+ list(input = {}, options = {}) {
10
+ return this.http.post('/api/server/offerings', {
11
+ ...options,
12
+ body: {
13
+ ...input,
14
+ appId: resolveAppId(input.appId, this.appId),
15
+ },
16
+ responseSchema: runtimeOfferingsResponseSchema,
17
+ });
18
+ }
19
+ }
20
+ function resolveAppId(inputAppId, defaultAppId) {
21
+ const appId = inputAppId ?? defaultAppId;
22
+ if (appId == null || appId.trim() === '') {
23
+ throw new Error('SubKit appId is required. Pass appId to the client or to this request.');
24
+ }
25
+ return appId;
26
+ }
27
+ //# sourceMappingURL=OfferingsClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OfferingsClient.js","sourceRoot":"","sources":["../src/OfferingsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,8BAA8B,GAC/B,MAAM,yBAAyB,CAAA;AAUhC,MAAM,OAAO,eAAe;IACT,KAAK,CAAoB;IACzB,IAAI,CAAY;IAEjC,YAAY,OAA+B;QACzC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED,IAAI,CACF,QAAoE,EAAE,EACtE,UAAgC,EAAE;QAElC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;YAC7C,GAAG,OAAO;YACV,IAAI,EAAE;gBACJ,GAAG,KAAK;gBACR,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;aAC7C;YACD,cAAc,EAAE,8BAA8B;SAC/C,CAAC,CAAA;IACJ,CAAC;CACF;AAED,SAAS,YAAY,CAAC,UAA8B,EAAE,YAAgC;IACpF,MAAM,KAAK,GAAG,UAAU,IAAI,YAAY,CAAA;IACxC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { z } from 'zod';
2
+ import type { HttpClient } from './HttpClient.js';
3
+ import type { SubKitMutationOptions } from './requestOptions.js';
4
+ declare const paymentResultSchema: z.ZodObject<{
5
+ accessSourceId: z.ZodNullable<z.ZodString>;
6
+ amountMicros: z.ZodNumber;
7
+ appId: z.ZodString;
8
+ billingAccountId: z.ZodNullable<z.ZodString>;
9
+ currencyCode: z.ZodString;
10
+ externalId: z.ZodString;
11
+ id: z.ZodString;
12
+ kind: z.ZodEnum<{
13
+ authorization: "authorization";
14
+ charge: "charge";
15
+ renewal: "renewal";
16
+ refund: "refund";
17
+ chargeback: "chargeback";
18
+ adjustment: "adjustment";
19
+ }>;
20
+ occurredAt: z.ZodCoercedDate<unknown>;
21
+ provider: z.ZodEnum<{
22
+ external: "external";
23
+ manual: "manual";
24
+ stripe: "stripe";
25
+ }>;
26
+ state: z.ZodEnum<{
27
+ pending: "pending";
28
+ failed: "failed";
29
+ succeeded: "succeeded";
30
+ reversed: "reversed";
31
+ }>;
32
+ }, z.core.$strip>;
33
+ export type PaymentResult = z.infer<typeof paymentResultSchema>;
34
+ export interface RecordPaymentInput {
35
+ accessSourceId?: string | null;
36
+ amountMicros: number;
37
+ appId?: string;
38
+ billingAccountId?: string | null;
39
+ currencyCode: string;
40
+ externalId: string;
41
+ kind: PaymentResult['kind'];
42
+ occurredAt: Date;
43
+ provider: PaymentResult['provider'];
44
+ reason: string;
45
+ state: PaymentResult['state'];
46
+ }
47
+ interface PaymentsClientOptions {
48
+ appId: string | undefined;
49
+ http: HttpClient;
50
+ }
51
+ export declare class PaymentsClient {
52
+ private readonly appId;
53
+ private readonly http;
54
+ constructor(options: PaymentsClientOptions);
55
+ record(input: RecordPaymentInput, options: SubKitMutationOptions): Promise<PaymentResult>;
56
+ }
57
+ export {};
58
+ //# sourceMappingURL=PaymentsClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentsClient.d.ts","sourceRoot":"","sources":["../src/PaymentsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAEhE,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYvB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3B,UAAU,EAAE,IAAI,CAAA;IAChB,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;CAC9B;AAED,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,OAAO,EAAE,qBAAqB;IAK1C,MAAM,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;CAW1F"}
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ const paymentResultSchema = z.object({
3
+ accessSourceId: z.string().nullable(),
4
+ amountMicros: z.number(),
5
+ appId: z.string(),
6
+ billingAccountId: z.string().nullable(),
7
+ currencyCode: z.string(),
8
+ externalId: z.string(),
9
+ id: z.string(),
10
+ kind: z.enum(['authorization', 'charge', 'renewal', 'refund', 'chargeback', 'adjustment']),
11
+ occurredAt: z.coerce.date(),
12
+ provider: z.enum(['stripe', 'external', 'manual']),
13
+ state: z.enum(['pending', 'succeeded', 'failed', 'reversed']),
14
+ });
15
+ export class PaymentsClient {
16
+ appId;
17
+ http;
18
+ constructor(options) {
19
+ this.appId = options.appId;
20
+ this.http = options.http;
21
+ }
22
+ record(input, options) {
23
+ return this.http.post('/api/server/payments', {
24
+ ...options,
25
+ body: {
26
+ ...input,
27
+ appId: resolveAppId(input.appId, this.appId),
28
+ occurredAt: input.occurredAt.toISOString(),
29
+ },
30
+ responseSchema: paymentResultSchema,
31
+ });
32
+ }
33
+ }
34
+ function resolveAppId(inputAppId, defaultAppId) {
35
+ const appId = inputAppId ?? defaultAppId;
36
+ if (appId == null || appId.trim() === '') {
37
+ throw new Error('SubKit appId is required. Pass appId to the client or to this request.');
38
+ }
39
+ return appId;
40
+ }
41
+ //# sourceMappingURL=PaymentsClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentsClient.js","sourceRoot":"","sources":["../src/PaymentsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC1F,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAClD,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;CAC9D,CAAC,CAAA;AAuBF,MAAM,OAAO,cAAc;IACR,KAAK,CAAoB;IACzB,IAAI,CAAY;IAEjC,YAAY,OAA8B;QACxC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,KAAyB,EAAE,OAA8B;QAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC5C,GAAG,OAAO;YACV,IAAI,EAAE;gBACJ,GAAG,KAAK;gBACR,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;gBAC5C,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE;aAC3C;YACD,cAAc,EAAE,mBAAmB;SACpC,CAAC,CAAA;IACJ,CAAC;CACF;AAED,SAAS,YAAY,CAAC,UAA8B,EAAE,YAAgC;IACpF,MAAM,KAAK,GAAG,UAAU,IAAI,YAAY,CAAA;IACxC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { type ServerProductsRequest, type ServerProductsResponse } from '@piparotech/subkit-core';
3
+ import type { HttpClient } from './HttpClient.js';
4
+ import type { SubKitMutationOptions, SubKitRequestOptions } from './requestOptions.js';
5
+ declare const planVersionLifecycleResultSchema: z.ZodObject<{
6
+ planVersionId: z.ZodString;
7
+ state: z.ZodEnum<{
8
+ published: "published";
9
+ retired: "retired";
10
+ }>;
11
+ }, z.core.$strip>;
12
+ export type PlanVersionLifecycleResult = z.infer<typeof planVersionLifecycleResultSchema>;
13
+ export interface UpdatePlanVersionLifecycleInput {
14
+ action: 'publish' | 'retire';
15
+ planVersionId: string;
16
+ reason: string;
17
+ }
18
+ interface ProductsClientOptions {
19
+ appId: string | undefined;
20
+ http: HttpClient;
21
+ }
22
+ export declare class ProductsClient {
23
+ private readonly appId;
24
+ private readonly http;
25
+ constructor(options: ProductsClientOptions);
26
+ updatePlanVersionLifecycle(input: UpdatePlanVersionLifecycleInput, options: SubKitMutationOptions): Promise<PlanVersionLifecycleResult>;
27
+ list(input?: Omit<ServerProductsRequest, 'appId'> & {
28
+ appId?: string;
29
+ }, options?: SubKitRequestOptions): Promise<ServerProductsResponse>;
30
+ }
31
+ export {};
32
+ //# sourceMappingURL=ProductsClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductsClient.d.ts","sourceRoot":"","sources":["../src/ProductsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAE5B,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAEtF,QAAA,MAAM,gCAAgC;;;;;;iBAGpC,CAAA;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAEzF,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC5B,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,OAAO,EAAE,qBAAqB;IAK1C,0BAA0B,CACxB,KAAK,EAAE,+BAA+B,EACtC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,0BAA0B,CAAC;IAStC,IAAI,CACF,KAAK,GAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,EACrE,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,sBAAsB,CAAC;CAUnC"}
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { serverProductsResponseSchema, } from '@piparotech/subkit-core';
3
+ const planVersionLifecycleResultSchema = z.object({
4
+ planVersionId: z.string(),
5
+ state: z.enum(['published', 'retired']),
6
+ });
7
+ export class ProductsClient {
8
+ appId;
9
+ http;
10
+ constructor(options) {
11
+ this.appId = options.appId;
12
+ this.http = options.http;
13
+ }
14
+ updatePlanVersionLifecycle(input, options) {
15
+ const { planVersionId, ...body } = input;
16
+ return this.http.patch(`/api/server/plan-versions/${encodeURIComponent(planVersionId)}`, {
17
+ ...options,
18
+ body,
19
+ responseSchema: planVersionLifecycleResultSchema,
20
+ });
21
+ }
22
+ list(input = {}, options = {}) {
23
+ return this.http.post('/api/server/products', {
24
+ ...options,
25
+ body: {
26
+ ...input,
27
+ appId: resolveAppId(input.appId, this.appId),
28
+ },
29
+ responseSchema: serverProductsResponseSchema,
30
+ });
31
+ }
32
+ }
33
+ function resolveAppId(inputAppId, defaultAppId) {
34
+ const appId = inputAppId ?? defaultAppId;
35
+ if (appId == null || appId.trim() === '') {
36
+ throw new Error('SubKit appId is required. Pass appId to the client or to this request.');
37
+ }
38
+ return appId;
39
+ }
40
+ //# sourceMappingURL=ProductsClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductsClient.js","sourceRoot":"","sources":["../src/ProductsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAGL,4BAA4B,GAC7B,MAAM,yBAAyB,CAAA;AAKhC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;CACxC,CAAC,CAAA;AAeF,MAAM,OAAO,cAAc;IACR,KAAK,CAAoB;IACzB,IAAI,CAAY;IAEjC,YAAY,OAA8B;QACxC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IAC1B,CAAC;IAED,0BAA0B,CACxB,KAAsC,EACtC,OAA8B;QAE9B,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,6BAA6B,kBAAkB,CAAC,aAAa,CAAC,EAAE,EAAE;YACvF,GAAG,OAAO;YACV,IAAI;YACJ,cAAc,EAAE,gCAAgC;SACjD,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,CACF,QAAmE,EAAE,EACrE,UAAgC,EAAE;QAElC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC5C,GAAG,OAAO;YACV,IAAI,EAAE;gBACJ,GAAG,KAAK;gBACR,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;aAC7C;YACD,cAAc,EAAE,4BAA4B;SAC7C,CAAC,CAAA;IACJ,CAAC;CACF;AAED,SAAS,YAAY,CAAC,UAA8B,EAAE,YAAgC;IACpF,MAAM,KAAK,GAAG,UAAU,IAAI,YAAY,CAAA;IACxC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { AccessClient } from './AccessClient.js';
2
+ import { ContractsClient } from './ContractsClient.js';
3
+ import { CustomersClient } from './CustomersClient.js';
4
+ import { DevicesClient } from './DevicesClient.js';
5
+ import { EntitlementsClient } from './EntitlementsClient.js';
6
+ import { type OperatorContext } from './HttpClient.js';
7
+ import { LicensesClient } from './LicensesClient.js';
8
+ import { OfferingsClient } from './OfferingsClient.js';
9
+ import { PaymentsClient } from './PaymentsClient.js';
10
+ import { ProductsClient } from './ProductsClient.js';
11
+ export interface SubKitOptions {
12
+ apiBaseUrl: string;
13
+ appId?: string;
14
+ fetch?: typeof fetch;
15
+ /**
16
+ * Human operator behind this trusted key (for example a CMS admin). Forwarded
17
+ * as audit evidence so SubKit distinguishes the technical key from the person.
18
+ */
19
+ operator?: OperatorContext;
20
+ secretKey: string;
21
+ timeoutMs?: number;
22
+ userAgent?: string;
23
+ }
24
+ export declare class SubKit {
25
+ readonly access: AccessClient;
26
+ readonly contracts: ContractsClient;
27
+ readonly customers: CustomersClient;
28
+ readonly devices: DevicesClient;
29
+ readonly entitlements: EntitlementsClient;
30
+ readonly licenses: LicensesClient;
31
+ readonly offerings: OfferingsClient;
32
+ readonly payments: PaymentsClient;
33
+ readonly products: ProductsClient;
34
+ constructor(options: SubKitOptions);
35
+ }
36
+ //# sourceMappingURL=SubKit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubKit.d.ts","sourceRoot":"","sources":["../src/SubKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,qBAAa,MAAM;IACjB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;IAC/B,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAA;IACzC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;IACnC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;gBAErB,OAAO,EAAE,aAAa;CAoBnC"}
package/dist/SubKit.js ADDED
@@ -0,0 +1,41 @@
1
+ import { AccessClient } from './AccessClient.js';
2
+ import { ContractsClient } from './ContractsClient.js';
3
+ import { CustomersClient } from './CustomersClient.js';
4
+ import { DevicesClient } from './DevicesClient.js';
5
+ import { EntitlementsClient } from './EntitlementsClient.js';
6
+ import { HttpClient } from './HttpClient.js';
7
+ import { LicensesClient } from './LicensesClient.js';
8
+ import { OfferingsClient } from './OfferingsClient.js';
9
+ import { PaymentsClient } from './PaymentsClient.js';
10
+ import { ProductsClient } from './ProductsClient.js';
11
+ export class SubKit {
12
+ access;
13
+ contracts;
14
+ customers;
15
+ devices;
16
+ entitlements;
17
+ licenses;
18
+ offerings;
19
+ payments;
20
+ products;
21
+ constructor(options) {
22
+ const http = new HttpClient({
23
+ apiBaseUrl: options.apiBaseUrl,
24
+ fetchImpl: options.fetch ?? fetch,
25
+ operator: options.operator,
26
+ secretKey: options.secretKey,
27
+ timeoutMs: options.timeoutMs ?? 10_000,
28
+ userAgent: options.userAgent ?? '@piparotech/subkit-node/0.1.9',
29
+ });
30
+ this.access = new AccessClient({ appId: options.appId, http });
31
+ this.contracts = new ContractsClient({ appId: options.appId, http });
32
+ this.customers = new CustomersClient({ appId: options.appId, http });
33
+ this.devices = new DevicesClient({ appId: options.appId, http });
34
+ this.entitlements = new EntitlementsClient({ appId: options.appId, http });
35
+ this.licenses = new LicensesClient({ appId: options.appId, http });
36
+ this.offerings = new OfferingsClient({ appId: options.appId, http });
37
+ this.payments = new PaymentsClient({ appId: options.appId, http });
38
+ this.products = new ProductsClient({ appId: options.appId, http });
39
+ }
40
+ }
41
+ //# sourceMappingURL=SubKit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubKit.js","sourceRoot":"","sources":["../src/SubKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAgBpD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AClE,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACpE,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAClE,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACpE,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ import type { SubKitErrorCode } from '@piparotech/subkit-core';
2
+ export declare class SubKitApiError extends Error {
3
+ readonly code: SubKitErrorCode;
4
+ readonly details: unknown;
5
+ readonly requestId: string | null;
6
+ readonly status: number;
7
+ constructor(input: {
8
+ code: SubKitErrorCode;
9
+ details?: unknown;
10
+ message: string;
11
+ requestId?: string | null;
12
+ status: number;
13
+ });
14
+ }
15
+ export declare function isSubKitApiError(error: unknown): error is SubKitApiError;
16
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAEX,KAAK,EAAE;QACjB,IAAI,EAAE,eAAe,CAAA;QACrB,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACzB,MAAM,EAAE,MAAM,CAAA;KACf;CAQF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE"}
package/dist/errors.js ADDED
@@ -0,0 +1,18 @@
1
+ export class SubKitApiError extends Error {
2
+ code;
3
+ details;
4
+ requestId;
5
+ status;
6
+ constructor(input) {
7
+ super(input.message);
8
+ this.name = 'SubKitApiError';
9
+ this.code = input.code;
10
+ this.details = input.details;
11
+ this.requestId = input.requestId ?? null;
12
+ this.status = input.status;
13
+ }
14
+ }
15
+ export function isSubKitApiError(error) {
16
+ return error instanceof SubKitApiError;
17
+ }
18
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,IAAI,CAAiB;IACrB,OAAO,CAAS;IAChB,SAAS,CAAe;IACxB,MAAM,CAAQ;IAEvB,YAAY,KAMX;QACC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,IAAI,CAAA;QACxC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IAC5B,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,cAAc,CAAA;AACxC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { SubKit } from './SubKit.js';
2
+ export type { SubKitOptions } from './SubKit.js';
3
+ export type { ServerDeviceActivation } from './DevicesClient.js';
4
+ export type { OperatorContext } from './HttpClient.js';
5
+ export { SubKitApiError, isSubKitApiError } from './errors.js';
6
+ export type { ContractLifecycleAction, ContractLifecycleApplyInput, ContractLifecyclePreview, ContractLifecyclePreviewInput, ContractLifecycleResult, ListLicensesInput, } from './LicensesClient.js';
7
+ export type { AllocateAccessInput, AllocationResult, ClaimReservationInput, FreeEnrollmentInput, FreeEnrollmentResult, ManualProvisionInput, MutationResult, PoolCapacityPreview, PoolResult, PreviewPoolCapacityInput, PromotionRedemptionResult, RedeemPromotionCodeInput, ReservationResult, ReserveAccessInput, RevokeReservationInput, UpdateAllocationInput, UpdatePoolInput, } from './AccessClient.js';
8
+ export type { ChangeContractLicenseeInput, ContractLicenseeResult, ContractResult, CreateContractInput, } from './ContractsClient.js';
9
+ export type { AddSubjectAliasInput, CreateBillingAccountInput, CustomerRecord, SubjectAliasResult, UpsertSubjectInput, } from './CustomersClient.js';
10
+ export type { PaymentResult, RecordPaymentInput } from './PaymentsClient.js';
11
+ export type { PlanVersionLifecycleResult, UpdatePlanVersionLifecycleInput, } from './ProductsClient.js';
12
+ export type { SubKitMutationOptions, SubKitRequestOptions } from './requestOptions.js';
13
+ export type { ServerContractPlanVersion, ServerContractPlanVersionsResponse, ServerCustomerEntitlement, ServerCustomerInfoRequest, ServerCustomerInfoResponse, ServerEntitlementCheckReason, ServerEntitlementCheckRequest, ServerEntitlementCheckResponse, ServerGrant, ServerGrantStatus, ServerLicenseDetailResponse, ServerLicenseKind, ServerLicenseListResponse, ServerLicenseSummary, ServerOfferingsRequest, ServerOperatorContext, RuntimeOfferingsResponse, ServerProduct, ServerProductsRequest, ServerProductsResponse, } from '@piparotech/subkit-core';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CA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,yBAAyB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { SubKit } from './SubKit.js';
2
+ export { SubKitApiError, isSubKitApiError } from './errors.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIpC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,9 @@
1
+ export interface SubKitRequestOptions {
2
+ idempotencyKey?: string;
3
+ signal?: AbortSignal;
4
+ timeoutMs?: number;
5
+ }
6
+ export interface SubKitMutationOptions extends SubKitRequestOptions {
7
+ idempotencyKey: string;
8
+ }
9
+ //# sourceMappingURL=requestOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestOptions.d.ts","sourceRoot":"","sources":["../src/requestOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,cAAc,EAAE,MAAM,CAAA;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=requestOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestOptions.js","sourceRoot":"","sources":["../src/requestOptions.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@piparotech/subkit-node",
3
+ "version": "0.1.10",
4
+ "type": "module",
5
+ "description": "Node.js backend SDK for querying SubKit.",
6
+ "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/piparotech/subkit.git",
10
+ "directory": "packages/subkit-node"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org/"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "CHANGELOG.md"
28
+ ],
29
+ "dependencies": {
30
+ "zod": "^4.4.3"
31
+ },
32
+ "peerDependencies": {
33
+ "@piparotech/subkit-core": "^0.1.10"
34
+ },
35
+ "devDependencies": {
36
+ "typescript": "~6.0.3",
37
+ "@piparotech/subkit-core": "0.1.10"
38
+ },
39
+ "engines": {
40
+ "node": ">=22"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.json",
44
+ "test": "pnpm build && node --test test/*.test.mjs",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit"
46
+ }
47
+ }