dodopayments 2.29.0 → 2.30.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.
Files changed (153) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/bin/cli +12 -5
  3. package/bin/migration-config.json +66 -0
  4. package/client.d.mts +11 -8
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +11 -8
  7. package/client.d.ts.map +1 -1
  8. package/client.js +3 -0
  9. package/client.js.map +1 -1
  10. package/client.mjs +3 -0
  11. package/client.mjs.map +1 -1
  12. package/internal/types.d.mts +6 -6
  13. package/internal/types.d.mts.map +1 -1
  14. package/internal/types.d.ts +6 -6
  15. package/internal/types.d.ts.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/checkout-sessions.d.mts +34 -0
  18. package/resources/checkout-sessions.d.mts.map +1 -1
  19. package/resources/checkout-sessions.d.ts +34 -0
  20. package/resources/checkout-sessions.d.ts.map +1 -1
  21. package/resources/credit-entitlements/balances.d.mts +1 -1
  22. package/resources/credit-entitlements/balances.d.mts.map +1 -1
  23. package/resources/credit-entitlements/balances.d.ts +1 -1
  24. package/resources/credit-entitlements/balances.d.ts.map +1 -1
  25. package/resources/customers/customers.d.mts +29 -1
  26. package/resources/customers/customers.d.mts.map +1 -1
  27. package/resources/customers/customers.d.ts +29 -1
  28. package/resources/customers/customers.d.ts.map +1 -1
  29. package/resources/customers/customers.js +6 -0
  30. package/resources/customers/customers.js.map +1 -1
  31. package/resources/customers/customers.mjs +6 -0
  32. package/resources/customers/customers.mjs.map +1 -1
  33. package/resources/customers/index.d.mts +1 -1
  34. package/resources/customers/index.d.mts.map +1 -1
  35. package/resources/customers/index.d.ts +1 -1
  36. package/resources/customers/index.d.ts.map +1 -1
  37. package/resources/customers/index.js.map +1 -1
  38. package/resources/customers/index.mjs.map +1 -1
  39. package/resources/entitlements/entitlements.d.mts +228 -0
  40. package/resources/entitlements/entitlements.d.mts.map +1 -0
  41. package/resources/entitlements/entitlements.d.ts +228 -0
  42. package/resources/entitlements/entitlements.d.ts.map +1 -0
  43. package/resources/entitlements/entitlements.js +60 -0
  44. package/resources/entitlements/entitlements.js.map +1 -0
  45. package/resources/entitlements/entitlements.mjs +55 -0
  46. package/resources/entitlements/entitlements.mjs.map +1 -0
  47. package/resources/entitlements/files.d.mts +37 -0
  48. package/resources/entitlements/files.d.mts.map +1 -0
  49. package/resources/entitlements/files.d.ts +37 -0
  50. package/resources/entitlements/files.d.ts.map +1 -0
  51. package/resources/entitlements/files.js +34 -0
  52. package/resources/entitlements/files.js.map +1 -0
  53. package/resources/entitlements/files.mjs +30 -0
  54. package/resources/entitlements/files.mjs.map +1 -0
  55. package/resources/entitlements/grants.d.mts +80 -0
  56. package/resources/entitlements/grants.d.mts.map +1 -0
  57. package/resources/entitlements/grants.d.ts +80 -0
  58. package/resources/entitlements/grants.d.ts.map +1 -0
  59. package/resources/entitlements/grants.js +27 -0
  60. package/resources/entitlements/grants.js.map +1 -0
  61. package/resources/entitlements/grants.mjs +23 -0
  62. package/resources/entitlements/grants.mjs.map +1 -0
  63. package/resources/entitlements/index.d.mts +4 -0
  64. package/resources/entitlements/index.d.mts.map +1 -0
  65. package/resources/entitlements/index.d.ts +4 -0
  66. package/resources/entitlements/index.d.ts.map +1 -0
  67. package/resources/entitlements/index.js +11 -0
  68. package/resources/entitlements/index.js.map +1 -0
  69. package/resources/entitlements/index.mjs +5 -0
  70. package/resources/entitlements/index.mjs.map +1 -0
  71. package/resources/entitlements.d.mts +2 -0
  72. package/resources/entitlements.d.mts.map +1 -0
  73. package/resources/entitlements.d.ts +2 -0
  74. package/resources/entitlements.d.ts.map +1 -0
  75. package/resources/entitlements.js +6 -0
  76. package/resources/entitlements.js.map +1 -0
  77. package/resources/entitlements.mjs +3 -0
  78. package/resources/entitlements.mjs.map +1 -0
  79. package/resources/index.d.mts +5 -4
  80. package/resources/index.d.mts.map +1 -1
  81. package/resources/index.d.ts +5 -4
  82. package/resources/index.d.ts.map +1 -1
  83. package/resources/index.js +3 -1
  84. package/resources/index.js.map +1 -1
  85. package/resources/index.mjs +1 -0
  86. package/resources/index.mjs.map +1 -1
  87. package/resources/license-key-instances.d.mts +4 -0
  88. package/resources/license-key-instances.d.mts.map +1 -1
  89. package/resources/license-key-instances.d.ts +4 -0
  90. package/resources/license-key-instances.d.ts.map +1 -1
  91. package/resources/payments.d.mts +26 -27
  92. package/resources/payments.d.mts.map +1 -1
  93. package/resources/payments.d.ts +26 -27
  94. package/resources/payments.d.ts.map +1 -1
  95. package/resources/products/index.d.mts +1 -1
  96. package/resources/products/index.d.mts.map +1 -1
  97. package/resources/products/index.d.ts +1 -1
  98. package/resources/products/index.d.ts.map +1 -1
  99. package/resources/products/index.js.map +1 -1
  100. package/resources/products/index.mjs.map +1 -1
  101. package/resources/products/products.d.mts +90 -121
  102. package/resources/products/products.d.mts.map +1 -1
  103. package/resources/products/products.d.ts +90 -121
  104. package/resources/products/products.d.ts.map +1 -1
  105. package/resources/products/products.js.map +1 -1
  106. package/resources/products/products.mjs.map +1 -1
  107. package/resources/subscriptions.d.mts +111 -128
  108. package/resources/subscriptions.d.mts.map +1 -1
  109. package/resources/subscriptions.d.ts +111 -128
  110. package/resources/subscriptions.d.ts.map +1 -1
  111. package/resources/webhook-events.d.mts +3 -25
  112. package/resources/webhook-events.d.mts.map +1 -1
  113. package/resources/webhook-events.d.ts +3 -25
  114. package/resources/webhook-events.d.ts.map +1 -1
  115. package/resources/webhook-events.js.map +1 -1
  116. package/resources/webhook-events.mjs.map +1 -1
  117. package/resources/webhooks/index.d.mts +1 -1
  118. package/resources/webhooks/index.d.mts.map +1 -1
  119. package/resources/webhooks/index.d.ts +1 -1
  120. package/resources/webhooks/index.d.ts.map +1 -1
  121. package/resources/webhooks/index.js.map +1 -1
  122. package/resources/webhooks/index.mjs.map +1 -1
  123. package/resources/webhooks/webhooks.d.mts +160 -3
  124. package/resources/webhooks/webhooks.d.mts.map +1 -1
  125. package/resources/webhooks/webhooks.d.ts +160 -3
  126. package/resources/webhooks/webhooks.d.ts.map +1 -1
  127. package/resources/webhooks/webhooks.js.map +1 -1
  128. package/resources/webhooks/webhooks.mjs.map +1 -1
  129. package/src/client.ts +45 -0
  130. package/src/internal/types.ts +6 -8
  131. package/src/resources/checkout-sessions.ts +38 -0
  132. package/src/resources/credit-entitlements/balances.ts +1 -0
  133. package/src/resources/customers/customers.ts +46 -0
  134. package/src/resources/customers/index.ts +1 -0
  135. package/src/resources/entitlements/entitlements.ts +384 -0
  136. package/src/resources/entitlements/files.ts +53 -0
  137. package/src/resources/entitlements/grants.ts +136 -0
  138. package/src/resources/entitlements/index.ts +22 -0
  139. package/src/resources/entitlements.ts +3 -0
  140. package/src/resources/index.ts +21 -0
  141. package/src/resources/license-key-instances.ts +5 -0
  142. package/src/resources/payments.ts +31 -33
  143. package/src/resources/products/index.ts +2 -0
  144. package/src/resources/products/products.ts +97 -189
  145. package/src/resources/subscriptions.ts +143 -151
  146. package/src/resources/webhook-events.ts +3 -47
  147. package/src/resources/webhooks/index.ts +5 -0
  148. package/src/resources/webhooks/webhooks.ts +212 -0
  149. package/src/version.ts +1 -1
  150. package/version.d.mts +1 -1
  151. package/version.d.ts +1 -1
  152. package/version.js +1 -1
  153. package/version.mjs +1 -1
@@ -0,0 +1,228 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as SubscriptionsAPI from "../subscriptions.js";
3
+ import * as FilesAPI from "./files.js";
4
+ import { FileDeleteParams, FileUploadResponse, Files } from "./files.js";
5
+ import * as GrantsAPI from "./grants.js";
6
+ import { EntitlementGrant, EntitlementGrantsDefaultPageNumberPagination, GrantListParams, GrantRevokeParams, Grants, LicenseKeyGrant } from "./grants.js";
7
+ import { APIPromise } from "../../core/api-promise.js";
8
+ import { DefaultPageNumberPagination, type DefaultPageNumberPaginationParams, PagePromise } from "../../core/pagination.js";
9
+ import { RequestOptions } from "../../internal/request-options.js";
10
+ export declare class Entitlements extends APIResource {
11
+ files: FilesAPI.Files;
12
+ grants: GrantsAPI.Grants;
13
+ /**
14
+ * POST /entitlements
15
+ */
16
+ create(body: EntitlementCreateParams, options?: RequestOptions): APIPromise<Entitlement>;
17
+ /**
18
+ * GET /entitlements/{id}
19
+ */
20
+ retrieve(id: string, options?: RequestOptions): APIPromise<Entitlement>;
21
+ /**
22
+ * PATCH /entitlements/{id}
23
+ */
24
+ update(id: string, body: EntitlementUpdateParams, options?: RequestOptions): APIPromise<Entitlement>;
25
+ /**
26
+ * GET /entitlements
27
+ */
28
+ list(query?: EntitlementListParams | null | undefined, options?: RequestOptions): PagePromise<EntitlementsDefaultPageNumberPagination, Entitlement>;
29
+ /**
30
+ * DELETE /entitlements/{id} (soft-delete)
31
+ */
32
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
33
+ }
34
+ export type EntitlementsDefaultPageNumberPagination = DefaultPageNumberPagination<Entitlement>;
35
+ export interface Entitlement {
36
+ id: string;
37
+ business_id: string;
38
+ created_at: string;
39
+ /**
40
+ * Public-facing variant of [`IntegrationConfig`]. Mirrors every variant shape on
41
+ * the wire EXCEPT `DigitalFiles`, which is replaced with a hydrated
42
+ * `digital_files` object (resolved download URLs etc.). The persisted JSONB stays
43
+ * ID-only via [`IntegrationConfig`]; this enum is response-only.
44
+ */
45
+ integration_config: IntegrationConfigResponse;
46
+ integration_type: EntitlementIntegrationType;
47
+ is_active: boolean;
48
+ name: string;
49
+ updated_at: string;
50
+ description?: string | null;
51
+ metadata?: unknown;
52
+ }
53
+ export type EntitlementIntegrationType = 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key';
54
+ /**
55
+ * Platform-specific configuration for an entitlement. Each variant uses unique
56
+ * field names so `#[serde(untagged)]` can disambiguate correctly.
57
+ */
58
+ export type IntegrationConfig = IntegrationConfig.GitHubConfig | IntegrationConfig.DiscordConfig | IntegrationConfig.TelegramConfig | IntegrationConfig.FigmaConfig | IntegrationConfig.FramerConfig | IntegrationConfig.NotionConfig | IntegrationConfig.DigitalFilesConfig | IntegrationConfig.LicenseKeyConfig;
59
+ export declare namespace IntegrationConfig {
60
+ interface GitHubConfig {
61
+ /**
62
+ * One of: pull, push, admin, maintain, triage
63
+ */
64
+ permission: string;
65
+ target_id: string;
66
+ }
67
+ interface DiscordConfig {
68
+ guild_id: string;
69
+ role_id?: string | null;
70
+ }
71
+ interface TelegramConfig {
72
+ chat_id: string;
73
+ }
74
+ interface FigmaConfig {
75
+ figma_file_id: string;
76
+ }
77
+ interface FramerConfig {
78
+ framer_template_id: string;
79
+ }
80
+ interface NotionConfig {
81
+ notion_template_id: string;
82
+ }
83
+ interface DigitalFilesConfig {
84
+ digital_file_ids: Array<string>;
85
+ external_url?: string | null;
86
+ instructions?: string | null;
87
+ /**
88
+ * Three-way patchable field (mirrors the credit_entitlements pattern):
89
+ *
90
+ * - omitted → preserve persisted (`None`)
91
+ * - `null` → clear (`Some(None)`)
92
+ * - `[...]` → replace (`Some(Some(...))`)
93
+ *
94
+ * On Create / storage we collapse "clear" and empty-array to `None` so the
95
+ * persisted JSONB never carries a `null` legacy_file_ids key.
96
+ */
97
+ legacy_file_ids?: Array<string> | null;
98
+ }
99
+ interface LicenseKeyConfig {
100
+ activation_message?: string | null;
101
+ activations_limit?: number | null;
102
+ duration_count?: number | null;
103
+ duration_interval?: SubscriptionsAPI.TimeInterval | null;
104
+ }
105
+ }
106
+ /**
107
+ * Public-facing variant of [`IntegrationConfig`]. Mirrors every variant shape on
108
+ * the wire EXCEPT `DigitalFiles`, which is replaced with a hydrated
109
+ * `digital_files` object (resolved download URLs etc.). The persisted JSONB stays
110
+ * ID-only via [`IntegrationConfig`]; this enum is response-only.
111
+ */
112
+ export type IntegrationConfigResponse = IntegrationConfigResponse.GitHubConfig | IntegrationConfigResponse.DiscordConfig | IntegrationConfigResponse.TelegramConfig | IntegrationConfigResponse.FigmaConfig | IntegrationConfigResponse.FramerConfig | IntegrationConfigResponse.NotionConfig | IntegrationConfigResponse.DigitalFilesConfig | IntegrationConfigResponse.LicenseKeyConfig;
113
+ export declare namespace IntegrationConfigResponse {
114
+ interface GitHubConfig {
115
+ permission: string;
116
+ target_id: string;
117
+ }
118
+ interface DiscordConfig {
119
+ guild_id: string;
120
+ role_id?: string | null;
121
+ }
122
+ interface TelegramConfig {
123
+ chat_id: string;
124
+ }
125
+ interface FigmaConfig {
126
+ figma_file_id: string;
127
+ }
128
+ interface FramerConfig {
129
+ framer_template_id: string;
130
+ }
131
+ interface NotionConfig {
132
+ notion_template_id: string;
133
+ }
134
+ interface DigitalFilesConfig {
135
+ /**
136
+ * Populated digital-files payload for entitlement read surfaces. Mirrors
137
+ * `DigitalProductDelivery` but is sourced from an entitlement's
138
+ * `integration_config` (not a grant) and tags each file with its origin (`legacy`
139
+ * vs `ee`).
140
+ */
141
+ digital_files: DigitalFilesConfig.DigitalFiles;
142
+ }
143
+ namespace DigitalFilesConfig {
144
+ /**
145
+ * Populated digital-files payload for entitlement read surfaces. Mirrors
146
+ * `DigitalProductDelivery` but is sourced from an entitlement's
147
+ * `integration_config` (not a grant) and tags each file with its origin (`legacy`
148
+ * vs `ee`).
149
+ */
150
+ interface DigitalFiles {
151
+ files: Array<DigitalFiles.File>;
152
+ external_url?: string | null;
153
+ instructions?: string | null;
154
+ }
155
+ namespace DigitalFiles {
156
+ interface File {
157
+ download_url: string;
158
+ /**
159
+ * Seconds until `download_url` expires.
160
+ */
161
+ expires_in: number;
162
+ file_id: string;
163
+ filename: string;
164
+ /**
165
+ * `"legacy"` for files in `product_files`, `"ee"` for files managed by the
166
+ * Entitlements Engine.
167
+ */
168
+ source: string;
169
+ content_type?: string | null;
170
+ file_size?: number | null;
171
+ }
172
+ }
173
+ }
174
+ interface LicenseKeyConfig {
175
+ activation_message?: string | null;
176
+ activations_limit?: number | null;
177
+ duration_count?: number | null;
178
+ duration_interval?: SubscriptionsAPI.TimeInterval | null;
179
+ }
180
+ }
181
+ export interface EntitlementCreateParams {
182
+ /**
183
+ * Platform-specific configuration (validated per integration_type)
184
+ */
185
+ integration_config: IntegrationConfig;
186
+ /**
187
+ * Which platform integration this entitlement uses
188
+ */
189
+ integration_type: EntitlementIntegrationType;
190
+ /**
191
+ * Display name for this entitlement
192
+ */
193
+ name: string;
194
+ /**
195
+ * Optional description
196
+ */
197
+ description?: string | null;
198
+ /**
199
+ * Optional user-facing metadata
200
+ */
201
+ metadata?: {
202
+ [key: string]: string;
203
+ } | null;
204
+ }
205
+ export interface EntitlementUpdateParams {
206
+ description?: string | null;
207
+ /**
208
+ * Platform-specific configuration for an entitlement. Each variant uses unique
209
+ * field names so `#[serde(untagged)]` can disambiguate correctly.
210
+ */
211
+ integration_config?: IntegrationConfig | null;
212
+ metadata?: {
213
+ [key: string]: string;
214
+ } | null;
215
+ name?: string | null;
216
+ }
217
+ export interface EntitlementListParams extends DefaultPageNumberPaginationParams {
218
+ /**
219
+ * Filter by integration type
220
+ */
221
+ integration_type?: 'discord' | 'telegram' | 'github' | 'figma' | 'framer' | 'notion' | 'digital_files' | 'license_key';
222
+ }
223
+ export declare namespace Entitlements {
224
+ export { type Entitlement as Entitlement, type EntitlementIntegrationType as EntitlementIntegrationType, type IntegrationConfig as IntegrationConfig, type IntegrationConfigResponse as IntegrationConfigResponse, type EntitlementsDefaultPageNumberPagination as EntitlementsDefaultPageNumberPagination, type EntitlementCreateParams as EntitlementCreateParams, type EntitlementUpdateParams as EntitlementUpdateParams, type EntitlementListParams as EntitlementListParams, };
225
+ export { Files as Files, type FileUploadResponse as FileUploadResponse, type FileDeleteParams as FileDeleteParams, };
226
+ export { Grants as Grants, type EntitlementGrant as EntitlementGrant, type LicenseKeyGrant as LicenseKeyGrant, type EntitlementGrantsDefaultPageNumberPagination as EntitlementGrantsDefaultPageNumberPagination, type GrantListParams as GrantListParams, type GrantRevokeParams as GrantRevokeParams, };
227
+ }
228
+ //# sourceMappingURL=entitlements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../../src/resources/entitlements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C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAE9C,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAE5C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,qBAAsB,SAAQ,iCAAiC;IAC9E;;OAEG;IACH,gBAAgB,CAAC,EACb,SAAS,GACT,UAAU,GACV,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,aAAa,CAAC;CACnB;AAKD,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uCAAuC,IAAI,uCAAuC,EACvF,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;IAEF,OAAO,EACL,KAAK,IAAI,KAAK,EACd,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;IAEF,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,4CAA4C,IAAI,4CAA4C,EACjG,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Entitlements = void 0;
5
+ const tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const FilesAPI = tslib_1.__importStar(require("./files.js"));
8
+ const files_1 = require("./files.js");
9
+ const GrantsAPI = tslib_1.__importStar(require("./grants.js"));
10
+ const grants_1 = require("./grants.js");
11
+ const pagination_1 = require("../../core/pagination.js");
12
+ const headers_1 = require("../../internal/headers.js");
13
+ const path_1 = require("../../internal/utils/path.js");
14
+ class Entitlements extends resource_1.APIResource {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.files = new FilesAPI.Files(this._client);
18
+ this.grants = new GrantsAPI.Grants(this._client);
19
+ }
20
+ /**
21
+ * POST /entitlements
22
+ */
23
+ create(body, options) {
24
+ return this._client.post('/entitlements', { body, ...options });
25
+ }
26
+ /**
27
+ * GET /entitlements/{id}
28
+ */
29
+ retrieve(id, options) {
30
+ return this._client.get((0, path_1.path) `/entitlements/${id}`, options);
31
+ }
32
+ /**
33
+ * PATCH /entitlements/{id}
34
+ */
35
+ update(id, body, options) {
36
+ return this._client.patch((0, path_1.path) `/entitlements/${id}`, { body, ...options });
37
+ }
38
+ /**
39
+ * GET /entitlements
40
+ */
41
+ list(query = {}, options) {
42
+ return this._client.getAPIList('/entitlements', (pagination_1.DefaultPageNumberPagination), {
43
+ query,
44
+ ...options,
45
+ });
46
+ }
47
+ /**
48
+ * DELETE /entitlements/{id} (soft-delete)
49
+ */
50
+ delete(id, options) {
51
+ return this._client.delete((0, path_1.path) `/entitlements/${id}`, {
52
+ ...options,
53
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
54
+ });
55
+ }
56
+ }
57
+ exports.Entitlements = Entitlements;
58
+ Entitlements.Files = files_1.Files;
59
+ Entitlements.Grants = grants_1.Grants;
60
+ //# sourceMappingURL=entitlements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../../src/resources/entitlements/entitlements.ts"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AI,EAAA,iBAAiB,EAAE,EAAE,EAAE;YACpD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AA/CD,oCA+CC;AA0RD,YAAY,CAAC,KAAK,GAAG,aAAK,CAAC;AAC3B,YAAY,CAAC,MAAM,GAAG,eAAM,CAAC"}
@@ -0,0 +1,55 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as FilesAPI from "./files.mjs";
4
+ import { Files } from "./files.mjs";
5
+ import * as GrantsAPI from "./grants.mjs";
6
+ import { Grants, } from "./grants.mjs";
7
+ import { DefaultPageNumberPagination, } from "../../core/pagination.mjs";
8
+ import { buildHeaders } from "../../internal/headers.mjs";
9
+ import { path } from "../../internal/utils/path.mjs";
10
+ export class Entitlements extends APIResource {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.files = new FilesAPI.Files(this._client);
14
+ this.grants = new GrantsAPI.Grants(this._client);
15
+ }
16
+ /**
17
+ * POST /entitlements
18
+ */
19
+ create(body, options) {
20
+ return this._client.post('/entitlements', { body, ...options });
21
+ }
22
+ /**
23
+ * GET /entitlements/{id}
24
+ */
25
+ retrieve(id, options) {
26
+ return this._client.get(path `/entitlements/${id}`, options);
27
+ }
28
+ /**
29
+ * PATCH /entitlements/{id}
30
+ */
31
+ update(id, body, options) {
32
+ return this._client.patch(path `/entitlements/${id}`, { body, ...options });
33
+ }
34
+ /**
35
+ * GET /entitlements
36
+ */
37
+ list(query = {}, options) {
38
+ return this._client.getAPIList('/entitlements', (DefaultPageNumberPagination), {
39
+ query,
40
+ ...options,
41
+ });
42
+ }
43
+ /**
44
+ * DELETE /entitlements/{id} (soft-delete)
45
+ */
46
+ delete(id, options) {
47
+ return this._client.delete(path `/entitlements/${id}`, {
48
+ ...options,
49
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
50
+ });
51
+ }
52
+ }
53
+ Entitlements.Files = Files;
54
+ Entitlements.Grants = Grants;
55
+ //# sourceMappingURL=entitlements.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.mjs","sourceRoot":"","sources":["../../src/resources/entitlements/entitlements.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,QAAQ;OACb,EAAwC,KAAK,EAAE;OAC/C,KAAK,SAAS;OACd,EAKL,MAAM,GAEP;OAEM,EACL,2BAA2B,GAG5B;OACM,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,YAAa,SAAQ,WAAW;IAA7C;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6ChE,CAAC;IA3CC;;OAEG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,iBAAiB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU,EAAE,IAA6B,EAAE,OAAwB;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,iBAAiB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,IAAI,CACF,QAAkD,EAAE,EACpD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA,2BAAwC,CAAA,EAAE;YACxF,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,iBAAiB,EAAE,EAAE,EAAE;YACpD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AA0RD,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import { APIPromise } from "../../core/api-promise.mjs";
3
+ import { RequestOptions } from "../../internal/request-options.mjs";
4
+ export declare class Files extends APIResource {
5
+ /**
6
+ * Companion to `post_entitlement_file`. Deletes the file from the Entitlements
7
+ * Engine (force=true) and atomically removes the `file_id` from the entitlement's
8
+ * `integration_config.digital_file_ids` JSONB array. EE delete happens first; if
9
+ * it fails we surface the error and leave local state untouched.
10
+ */
11
+ delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<void>;
12
+ /**
13
+ * Streams a multipart/form-data body to the Entitlements Engine
14
+ * (`POST /api/digital-files/dodo/files/upload`) and appends the returned `file_id`
15
+ * to the entitlement's `integration_config.digital_file_ids` using a JSONB array
16
+ * append. Compensates EE-side on local DB write failure (best-effort delete of the
17
+ * just-uploaded file).
18
+ */
19
+ upload(id: string, options?: RequestOptions): APIPromise<FileUploadResponse>;
20
+ }
21
+ export interface FileUploadResponse {
22
+ /**
23
+ * EE-issued digital file id; appended to
24
+ * `entitlements.integration_config.digital_file_ids`.
25
+ */
26
+ file_id: string;
27
+ }
28
+ export interface FileDeleteParams {
29
+ /**
30
+ * Entitlement Id
31
+ */
32
+ id: string;
33
+ }
34
+ export declare namespace Files {
35
+ export { type FileUploadResponse as FileUploadResponse, type FileDeleteParams as FileDeleteParams };
36
+ }
37
+ //# sourceMappingURL=files.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../../src/resources/entitlements/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAQ5F;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;CAG7E;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,kBAAkB,IAAI,kBAAkB,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;CACrG"}
@@ -0,0 +1,37 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import { APIPromise } from "../../core/api-promise.js";
3
+ import { RequestOptions } from "../../internal/request-options.js";
4
+ export declare class Files extends APIResource {
5
+ /**
6
+ * Companion to `post_entitlement_file`. Deletes the file from the Entitlements
7
+ * Engine (force=true) and atomically removes the `file_id` from the entitlement's
8
+ * `integration_config.digital_file_ids` JSONB array. EE delete happens first; if
9
+ * it fails we surface the error and leave local state untouched.
10
+ */
11
+ delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<void>;
12
+ /**
13
+ * Streams a multipart/form-data body to the Entitlements Engine
14
+ * (`POST /api/digital-files/dodo/files/upload`) and appends the returned `file_id`
15
+ * to the entitlement's `integration_config.digital_file_ids` using a JSONB array
16
+ * append. Compensates EE-side on local DB write failure (best-effort delete of the
17
+ * just-uploaded file).
18
+ */
19
+ upload(id: string, options?: RequestOptions): APIPromise<FileUploadResponse>;
20
+ }
21
+ export interface FileUploadResponse {
22
+ /**
23
+ * EE-issued digital file id; appended to
24
+ * `entitlements.integration_config.digital_file_ids`.
25
+ */
26
+ file_id: string;
27
+ }
28
+ export interface FileDeleteParams {
29
+ /**
30
+ * Entitlement Id
31
+ */
32
+ id: string;
33
+ }
34
+ export declare namespace Files {
35
+ export { type FileUploadResponse as FileUploadResponse, type FileDeleteParams as FileDeleteParams };
36
+ }
37
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/entitlements/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAQ5F;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;CAG7E;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,kBAAkB,IAAI,kBAAkB,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;CACrG"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Files = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const headers_1 = require("../../internal/headers.js");
7
+ const path_1 = require("../../internal/utils/path.js");
8
+ class Files extends resource_1.APIResource {
9
+ /**
10
+ * Companion to `post_entitlement_file`. Deletes the file from the Entitlements
11
+ * Engine (force=true) and atomically removes the `file_id` from the entitlement's
12
+ * `integration_config.digital_file_ids` JSONB array. EE delete happens first; if
13
+ * it fails we surface the error and leave local state untouched.
14
+ */
15
+ delete(fileID, params, options) {
16
+ const { id } = params;
17
+ return this._client.delete((0, path_1.path) `/entitlements/${id}/files/${fileID}`, {
18
+ ...options,
19
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
20
+ });
21
+ }
22
+ /**
23
+ * Streams a multipart/form-data body to the Entitlements Engine
24
+ * (`POST /api/digital-files/dodo/files/upload`) and appends the returned `file_id`
25
+ * to the entitlement's `integration_config.digital_file_ids` using a JSONB array
26
+ * append. Compensates EE-side on local DB write failure (best-effort delete of the
27
+ * just-uploaded file).
28
+ */
29
+ upload(id, options) {
30
+ return this._client.post((0, path_1.path) `/entitlements/${id}/files`, options);
31
+ }
32
+ }
33
+ exports.Files = Files;
34
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/resources/entitlements/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;OAKG;IACH,MAAM,CAAC,MAAc,EAAE,MAAwB,EAAE,OAAwB;QACvE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,iBAAiB,EAAE,UAAU,MAAM,EAAE,EAAE;YACpE,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;CACF;AAzBD,sBAyBC"}
@@ -0,0 +1,30 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { buildHeaders } from "../../internal/headers.mjs";
4
+ import { path } from "../../internal/utils/path.mjs";
5
+ export class Files extends APIResource {
6
+ /**
7
+ * Companion to `post_entitlement_file`. Deletes the file from the Entitlements
8
+ * Engine (force=true) and atomically removes the `file_id` from the entitlement's
9
+ * `integration_config.digital_file_ids` JSONB array. EE delete happens first; if
10
+ * it fails we surface the error and leave local state untouched.
11
+ */
12
+ delete(fileID, params, options) {
13
+ const { id } = params;
14
+ return this._client.delete(path `/entitlements/${id}/files/${fileID}`, {
15
+ ...options,
16
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
17
+ });
18
+ }
19
+ /**
20
+ * Streams a multipart/form-data body to the Entitlements Engine
21
+ * (`POST /api/digital-files/dodo/files/upload`) and appends the returned `file_id`
22
+ * to the entitlement's `integration_config.digital_file_ids` using a JSONB array
23
+ * append. Compensates EE-side on local DB write failure (best-effort delete of the
24
+ * just-uploaded file).
25
+ */
26
+ upload(id, options) {
27
+ return this._client.post(path `/entitlements/${id}/files`, options);
28
+ }
29
+ }
30
+ //# sourceMappingURL=files.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.mjs","sourceRoot":"","sources":["../../src/resources/entitlements/files.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;OAKG;IACH,MAAM,CAAC,MAAc,EAAE,MAAwB,EAAE,OAAwB;QACvE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,iBAAiB,EAAE,UAAU,MAAM,EAAE,EAAE;YACpE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;CACF"}
@@ -0,0 +1,80 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import * as ProductsAPI from "../products/products.mjs";
3
+ import { APIPromise } from "../../core/api-promise.mjs";
4
+ import { DefaultPageNumberPagination, type DefaultPageNumberPaginationParams, PagePromise } from "../../core/pagination.mjs";
5
+ import { RequestOptions } from "../../internal/request-options.mjs";
6
+ export declare class Grants extends APIResource {
7
+ /**
8
+ * GET /entitlements/{id}/grants (public API)
9
+ */
10
+ list(id: string, query?: GrantListParams | null | undefined, options?: RequestOptions): PagePromise<EntitlementGrantsDefaultPageNumberPagination, EntitlementGrant>;
11
+ /**
12
+ * Revokes a single entitlement grant for the caller's business. For LicenseKey
13
+ * integrations, also disables the backing license key. Idempotent: re-revoking an
14
+ * already-revoked grant returns 200 with current state. The revocation reason is
15
+ * always set to "manual" for API-initiated revocations.
16
+ */
17
+ revoke(grantID: string, params: GrantRevokeParams, options?: RequestOptions): APIPromise<EntitlementGrant>;
18
+ }
19
+ export type EntitlementGrantsDefaultPageNumberPagination = DefaultPageNumberPagination<EntitlementGrant>;
20
+ export interface EntitlementGrant {
21
+ id: string;
22
+ business_id: string;
23
+ created_at: string;
24
+ customer_id: string;
25
+ entitlement_id: string;
26
+ external_id: string;
27
+ status: 'Pending' | 'Delivered' | 'Failed' | 'Revoked';
28
+ updated_at: string;
29
+ delivered_at?: string | null;
30
+ /**
31
+ * Present only when the entitlement integration_type is `digital_files`. Populated
32
+ * eagerly on every list and single-record endpoint.
33
+ */
34
+ digital_product_delivery?: ProductsAPI.DigitalProductDelivery | null;
35
+ error_code?: string | null;
36
+ error_message?: string | null;
37
+ /**
38
+ * Present only when the entitlement integration_type is `license_key`.
39
+ */
40
+ license_key?: LicenseKeyGrant | null;
41
+ metadata?: unknown;
42
+ oauth_expires_at?: string | null;
43
+ oauth_url?: string | null;
44
+ payment_id?: string | null;
45
+ revocation_reason?: string | null;
46
+ revoked_at?: string | null;
47
+ subscription_id?: string | null;
48
+ }
49
+ /**
50
+ * Nested representation of license-key grant fields. Present only when the grant's
51
+ * entitlement has `integration_type = 'license_key'` and a row exists in
52
+ * `license_keys`. The grant's top-level `status` is the source of truth for the
53
+ * grant's lifecycle — no per-license-key status is exposed here.
54
+ */
55
+ export interface LicenseKeyGrant {
56
+ activations_used: number;
57
+ key: string;
58
+ activations_limit?: number | null;
59
+ expires_at?: string | null;
60
+ }
61
+ export interface GrantListParams extends DefaultPageNumberPaginationParams {
62
+ /**
63
+ * Filter by customer ID
64
+ */
65
+ customer_id?: string;
66
+ /**
67
+ * Filter by grant status
68
+ */
69
+ status?: 'Pending' | 'Delivered' | 'Failed' | 'Revoked';
70
+ }
71
+ export interface GrantRevokeParams {
72
+ /**
73
+ * Entitlement ID
74
+ */
75
+ id: string;
76
+ }
77
+ export declare namespace Grants {
78
+ export { type EntitlementGrant as EntitlementGrant, type LicenseKeyGrant as LicenseKeyGrant, type EntitlementGrantsDefaultPageNumberPagination as EntitlementGrantsDefaultPageNumberPagination, type GrantListParams as GrantListParams, type GrantRevokeParams as GrantRevokeParams, };
79
+ }
80
+ //# sourceMappingURL=grants.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grants.d.mts","sourceRoot":"","sources":["../../src/resources/entitlements/grants.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OACd,EACL,2BAA2B,EAC3B,KAAK,iCAAiC,EACtC,WAAW,EACZ;OACM,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,IAAI,CACF,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,eAAe,GAAG,IAAI,GAAG,SAAc,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,4CAA4C,EAAE,gBAAgB,CAAC;IAQ9E;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC;CAI3G;AAED,MAAM,MAAM,4CAA4C,GAAG,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;AAEzG,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,WAAW,EAAE,MAAM,CAAC;IAEpB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,cAAc,EAAE,MAAM,CAAC;IAEvB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG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