@settlemint/dalp-sdk 2.1.7-main.25439742376 → 2.1.7-main.25441323068

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 (2) hide show
  1. package/dist/index.js +67 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16071,6 +16071,11 @@ var FeatureConfigsInputSchema = z189.object({
16071
16071
  ]
16072
16072
  });
16073
16073
 
16074
+ // ../../packages/dalp/api-contract/src/routes/token/routes/mutations/create/helpers/create-handlers/compliance-template-sentinels.ts
16075
+ var NO_COMPLIANCE_SENTINEL = "no-compliance";
16076
+ var MANUAL_MODE_SENTINEL = "none";
16077
+ var COMPLIANCE_TEMPLATE_OPT_OUT_SENTINELS = [NO_COMPLIANCE_SENTINEL, MANUAL_MODE_SENTINEL];
16078
+
16074
16079
  // ../../packages/dalp/api-contract/src/routes/token/routes/mutations/create/helpers/create-handlers/dalp-asset.create.schema.ts
16075
16080
  var DALPAssetTokenSchema = TokenBaseSchema.extend({
16076
16081
  type: z190.literal(AssetFactoryTypeIdEnum.dalpAsset),
@@ -16078,6 +16083,14 @@ var DALPAssetTokenSchema = TokenBaseSchema.extend({
16078
16083
  description: "ID of the instrument template used to create this token",
16079
16084
  examples: ["template-bond-standard"]
16080
16085
  }),
16086
+ complianceTemplateSelection: z190.string().optional().meta({
16087
+ description: "Wizard-supplied signal identifying the chosen compliance template (or 'no-compliance' / 'none'). " + "Used by the dapi guard that rejects an empty initialModulePairs when a template was chosen.",
16088
+ examples: ["template-eu-retail-mifid-aligned", NO_COMPLIANCE_SENTINEL, MANUAL_MODE_SENTINEL]
16089
+ }),
16090
+ complianceTemplateExpectedTypeIds: z190.array(complianceTypeId()).optional().meta({
16091
+ description: "Wizard-supplied list of compliance type ids declared by the chosen template. " + "When present, the dapi guard validates that initialModulePairs covers every entry.",
16092
+ examples: [["identity-verification-v2", "country-allow-list-v2"]]
16093
+ }),
16081
16094
  priceCurrency: fiatCurrency().optional().meta({
16082
16095
  description: "The fiat currency code for valuation (e.g., USD, EUR)",
16083
16096
  examples: ["USD", "EUR", "GBP"]
@@ -16091,6 +16104,59 @@ var DALPAssetTokenSchema = TokenBaseSchema.extend({
16091
16104
  examples: [{ issuerName: "Acme Corp", maturityType: "fixed" }]
16092
16105
  }),
16093
16106
  featureConfigs: FeatureConfigsInputSchema.optional().default({})
16107
+ }).superRefine((input, ctx) => {
16108
+ const selection = input.complianceTemplateSelection;
16109
+ const isOptOut = selection === undefined || selection === "" || COMPLIANCE_TEMPLATE_OPT_OUT_SENTINELS.includes(selection);
16110
+ if (isOptOut) {
16111
+ return;
16112
+ }
16113
+ const pairs = input.initialModulePairs ?? [];
16114
+ if (pairs.length === 0) {
16115
+ ctx.addIssue({
16116
+ code: "custom",
16117
+ path: ["initialModulePairs"],
16118
+ params: { code: "COMPLIANCE_TEMPLATE_NO_PAIRS" },
16119
+ message: "Compliance template was chosen but no compliance modules were submitted. " + "This usually means the wizard failed to expand the template's controls into module pairs. " + "Reload the page and re-select the template, or switch to manual configuration."
16120
+ });
16121
+ return;
16122
+ }
16123
+ const expected = input.complianceTemplateExpectedTypeIds;
16124
+ if (expected && expected.length > 0) {
16125
+ const expectedCounts = new Map;
16126
+ for (const typeId of expected) {
16127
+ expectedCounts.set(typeId, (expectedCounts.get(typeId) ?? 0) + 1);
16128
+ }
16129
+ const submittedCounts = new Map;
16130
+ for (const pair of pairs) {
16131
+ submittedCounts.set(pair.typeId, (submittedCounts.get(pair.typeId) ?? 0) + 1);
16132
+ }
16133
+ const missing = [];
16134
+ for (const [typeId, expectedCount] of expectedCounts) {
16135
+ const submittedCount = submittedCounts.get(typeId) ?? 0;
16136
+ if (submittedCount < expectedCount) {
16137
+ const shortfall = expectedCount - submittedCount;
16138
+ missing.push(shortfall === 1 ? typeId : `${typeId} (×${shortfall})`);
16139
+ }
16140
+ }
16141
+ if (missing.length > 0) {
16142
+ ctx.addIssue({
16143
+ code: "custom",
16144
+ path: ["initialModulePairs"],
16145
+ params: { code: "COMPLIANCE_TEMPLATE_MISSING_CONTROLS", missing },
16146
+ message: `Compliance template requires controls that were not submitted: ${missing.join(", ")}. ` + "Every control declared by the template must appear in initialModulePairs."
16147
+ });
16148
+ }
16149
+ }
16150
+ pairs.forEach((pair, index) => {
16151
+ if ((pair.typeId === "country-allow-list-v2" || pair.typeId === "country-allow-list") && Array.isArray(pair.values) && pair.values.length === 0) {
16152
+ ctx.addIssue({
16153
+ code: "custom",
16154
+ path: ["initialModulePairs", index, "values"],
16155
+ params: { code: "COMPLIANCE_COUNTRY_ALLOW_LIST_EMPTY", typeId: pair.typeId },
16156
+ message: `${pair.typeId} requires at least one country code. ` + "An empty allow-list blocks every transfer on-chain — pick the countries the asset is allowed to settle to, or pick a different control."
16157
+ });
16158
+ }
16159
+ });
16094
16160
  });
16095
16161
 
16096
16162
  // ../../packages/dalp/api-contract/src/routes/token/routes/mutations/create/helpers/create-handlers/deposit.create.schema.ts
@@ -26953,7 +27019,7 @@ function normalizeDalpBaseUrl(url) {
26953
27019
  // package.json
26954
27020
  var package_default = {
26955
27021
  name: "@settlemint/dalp-sdk",
26956
- version: "2.1.7-main.25439742376",
27022
+ version: "2.1.7-main.25441323068",
26957
27023
  private: false,
26958
27024
  description: "Fully typed SDK for the DALP tokenization platform API",
26959
27025
  homepage: "https://settlemint.com",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@settlemint/dalp-sdk",
3
- "version": "2.1.7-main.25439742376",
3
+ "version": "2.1.7-main.25441323068",
4
4
  "private": false,
5
5
  "description": "Fully typed SDK for the DALP tokenization platform API",
6
6
  "homepage": "https://settlemint.com",