alchemy 0.41.1 → 0.42.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 (48) hide show
  1. package/README.md +2 -0
  2. package/bin/alchemy.mjs +99 -44
  3. package/lib/build-date.d.ts +1 -1
  4. package/lib/build-date.js +1 -1
  5. package/lib/cloudflare/certificate-pack.d.ts +216 -0
  6. package/lib/cloudflare/certificate-pack.d.ts.map +1 -0
  7. package/lib/cloudflare/certificate-pack.js +350 -0
  8. package/lib/cloudflare/certificate-pack.js.map +1 -0
  9. package/lib/cloudflare/container.d.ts +6 -0
  10. package/lib/cloudflare/container.d.ts.map +1 -1
  11. package/lib/cloudflare/container.js +32 -25
  12. package/lib/cloudflare/container.js.map +1 -1
  13. package/lib/cloudflare/index.d.ts +3 -0
  14. package/lib/cloudflare/index.d.ts.map +1 -1
  15. package/lib/cloudflare/index.js +3 -0
  16. package/lib/cloudflare/index.js.map +1 -1
  17. package/lib/cloudflare/orange.d.ts +37 -0
  18. package/lib/cloudflare/orange.d.ts.map +1 -0
  19. package/lib/cloudflare/orange.js +48 -0
  20. package/lib/cloudflare/orange.js.map +1 -0
  21. package/lib/cloudflare/redirect-rule.d.ts +168 -0
  22. package/lib/cloudflare/redirect-rule.d.ts.map +1 -0
  23. package/lib/cloudflare/redirect-rule.js +380 -0
  24. package/lib/cloudflare/redirect-rule.js.map +1 -0
  25. package/lib/cloudflare/worker/miniflare-worker-options.d.ts.map +1 -1
  26. package/lib/cloudflare/worker/miniflare-worker-options.js +11 -12
  27. package/lib/cloudflare/worker/miniflare-worker-options.js.map +1 -1
  28. package/lib/cloudflare/worker.d.ts +1 -1
  29. package/lib/fs/file-system-state-store.d.ts.map +1 -1
  30. package/lib/fs/file-system-state-store.js +8 -1
  31. package/lib/fs/file-system-state-store.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/build-date.ts +1 -1
  34. package/src/cloudflare/certificate-pack.ts +698 -0
  35. package/src/cloudflare/container.ts +44 -30
  36. package/src/cloudflare/index.ts +3 -0
  37. package/src/cloudflare/orange.ts +61 -0
  38. package/src/cloudflare/redirect-rule.ts +642 -0
  39. package/src/cloudflare/worker/miniflare-worker-options.ts +14 -12
  40. package/src/fs/file-system-state-store.ts +8 -1
  41. package/templates/astro/package.json +1 -1
  42. package/templates/nuxt/package.json +1 -1
  43. package/templates/react-router/package.json +1 -1
  44. package/templates/rwsdk/package.json +1 -1
  45. package/templates/sveltekit/package.json +1 -1
  46. package/templates/tanstack-start/package.json +1 -1
  47. package/templates/typescript/package.json +1 -1
  48. package/templates/vite/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Alchemy
2
2
 
3
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/sam-goodwin/alchemy)
4
+
3
5
  Alchemy is an embeddable, TypeScript-native Infrastructure-as-Code (IaC) library for modeling Resources that are Created, Updated and Deleted automatically. It's like Terraform, but in pure TypeScript.
4
6
 
5
7
  Unlike similar tools like Pulumi, Terraform, and CloudFormation, Alchemy is implemented in pure ESM-native TypeScript code with zero dependencies.
package/bin/alchemy.mjs CHANGED
@@ -16444,7 +16444,8 @@ var require_Options = __commonJS({
16444
16444
  applyRegexFlags: false,
16445
16445
  emailStrategy: "format:email",
16446
16446
  base64Strategy: "contentEncoding:base64",
16447
- nameStrategy: "ref"
16447
+ nameStrategy: "ref",
16448
+ openAiAnyTypeName: "OpenAiAnyType"
16448
16449
  };
16449
16450
  var getDefaultOptions = (options2) => typeof options2 === "string" ? {
16450
16451
  ...exports2.defaultOptions,
@@ -16469,6 +16470,7 @@ var require_Refs = __commonJS({
16469
16470
  const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
16470
16471
  return {
16471
16472
  ..._options,
16473
+ flags: { hasReferencedOpenAiAnyType: false },
16472
16474
  currentPath,
16473
16475
  propertyPath: void 0,
16474
16476
  seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
@@ -16511,6 +16513,24 @@ var require_errorMessages = __commonJS({
16511
16513
  }
16512
16514
  });
16513
16515
 
16516
+ // ../node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js
16517
+ var require_getRelativePath = __commonJS({
16518
+ "../node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js"(exports2) {
16519
+ "use strict";
16520
+ Object.defineProperty(exports2, "__esModule", { value: true });
16521
+ exports2.getRelativePath = void 0;
16522
+ var getRelativePath = (pathA, pathB) => {
16523
+ let i2 = 0;
16524
+ for (; i2 < pathA.length && i2 < pathB.length; i2++) {
16525
+ if (pathA[i2] !== pathB[i2])
16526
+ break;
16527
+ }
16528
+ return [(pathA.length - i2).toString(), ...pathB.slice(i2)].join("/");
16529
+ };
16530
+ exports2.getRelativePath = getRelativePath;
16531
+ }
16532
+ });
16533
+
16514
16534
  // ../node_modules/zod/dist/cjs/v3/helpers/util.js
16515
16535
  var require_util2 = __commonJS({
16516
16536
  "../node_modules/zod/dist/cjs/v3/helpers/util.js"(exports2) {
@@ -20714,8 +20734,20 @@ var require_any = __commonJS({
20714
20734
  "use strict";
20715
20735
  Object.defineProperty(exports2, "__esModule", { value: true });
20716
20736
  exports2.parseAnyDef = void 0;
20717
- function parseAnyDef() {
20718
- return {};
20737
+ var getRelativePath_js_1 = require_getRelativePath();
20738
+ function parseAnyDef(refs) {
20739
+ if (refs.target !== "openAi") {
20740
+ return {};
20741
+ }
20742
+ const anyDefinitionPath = [
20743
+ ...refs.basePath,
20744
+ refs.definitionPath,
20745
+ refs.openAiAnyTypeName
20746
+ ];
20747
+ refs.flags.hasReferencedOpenAiAnyType = true;
20748
+ return {
20749
+ $ref: refs.$refStrategy === "relative" ? (0, getRelativePath_js_1.getRelativePath)(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
20750
+ };
20719
20751
  }
20720
20752
  exports2.parseAnyDef = parseAnyDef;
20721
20753
  }
@@ -20946,8 +20978,9 @@ var require_effects = __commonJS({
20946
20978
  Object.defineProperty(exports2, "__esModule", { value: true });
20947
20979
  exports2.parseEffectsDef = void 0;
20948
20980
  var parseDef_js_1 = require_parseDef();
20981
+ var any_js_1 = require_any();
20949
20982
  function parseEffectsDef(_def, refs) {
20950
- return refs.effectStrategy === "input" ? (0, parseDef_js_1.parseDef)(_def.schema._def, refs) : {};
20983
+ return refs.effectStrategy === "input" ? (0, parseDef_js_1.parseDef)(_def.schema._def, refs) : (0, any_js_1.parseAnyDef)(refs);
20951
20984
  }
20952
20985
  exports2.parseEffectsDef = parseEffectsDef;
20953
20986
  }
@@ -21392,6 +21425,7 @@ var require_record = __commonJS({
21392
21425
  var parseDef_js_1 = require_parseDef();
21393
21426
  var string_js_1 = require_string();
21394
21427
  var branded_js_1 = require_branded();
21428
+ var any_js_1 = require_any();
21395
21429
  function parseRecordDef(def, refs) {
21396
21430
  if (refs.target === "openAi") {
21397
21431
  console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
@@ -21405,7 +21439,7 @@ var require_record = __commonJS({
21405
21439
  [key]: (0, parseDef_js_1.parseDef)(def.valueType._def, {
21406
21440
  ...refs,
21407
21441
  currentPath: [...refs.currentPath, "properties", key]
21408
- }) ?? {}
21442
+ }) ?? (0, any_js_1.parseAnyDef)(refs)
21409
21443
  }), {}),
21410
21444
  additionalProperties: refs.rejectedAdditionalProperties
21411
21445
  };
@@ -21454,6 +21488,7 @@ var require_map = __commonJS({
21454
21488
  exports2.parseMapDef = void 0;
21455
21489
  var parseDef_js_1 = require_parseDef();
21456
21490
  var record_js_1 = require_record();
21491
+ var any_js_1 = require_any();
21457
21492
  function parseMapDef(def, refs) {
21458
21493
  if (refs.mapStrategy === "record") {
21459
21494
  return (0, record_js_1.parseRecordDef)(def, refs);
@@ -21461,11 +21496,11 @@ var require_map = __commonJS({
21461
21496
  const keys = (0, parseDef_js_1.parseDef)(def.keyType._def, {
21462
21497
  ...refs,
21463
21498
  currentPath: [...refs.currentPath, "items", "items", "0"]
21464
- }) || {};
21499
+ }) || (0, any_js_1.parseAnyDef)(refs);
21465
21500
  const values = (0, parseDef_js_1.parseDef)(def.valueType._def, {
21466
21501
  ...refs,
21467
21502
  currentPath: [...refs.currentPath, "items", "items", "1"]
21468
- }) || {};
21503
+ }) || (0, any_js_1.parseAnyDef)(refs);
21469
21504
  return {
21470
21505
  type: "array",
21471
21506
  maxItems: 125,
@@ -21509,9 +21544,13 @@ var require_never = __commonJS({
21509
21544
  "use strict";
21510
21545
  Object.defineProperty(exports2, "__esModule", { value: true });
21511
21546
  exports2.parseNeverDef = void 0;
21512
- function parseNeverDef() {
21513
- return {
21514
- not: {}
21547
+ var any_js_1 = require_any();
21548
+ function parseNeverDef(refs) {
21549
+ return refs.target === "openAi" ? void 0 : {
21550
+ not: (0, any_js_1.parseAnyDef)({
21551
+ ...refs,
21552
+ currentPath: [...refs.currentPath, "not"]
21553
+ })
21515
21554
  };
21516
21555
  }
21517
21556
  exports2.parseNeverDef = parseNeverDef;
@@ -21719,7 +21758,6 @@ var require_object = __commonJS({
21719
21758
  "use strict";
21720
21759
  Object.defineProperty(exports2, "__esModule", { value: true });
21721
21760
  exports2.parseObjectDef = void 0;
21722
- var zod_1 = require_cjs();
21723
21761
  var parseDef_js_1 = require_parseDef();
21724
21762
  function parseObjectDef(def, refs) {
21725
21763
  const forceOptionalIntoNullable = refs.target === "openAi";
@@ -21736,7 +21774,7 @@ var require_object = __commonJS({
21736
21774
  }
21737
21775
  let propOptional = safeIsOptional(propDef);
21738
21776
  if (propOptional && forceOptionalIntoNullable) {
21739
- if (propDef instanceof zod_1.ZodOptional) {
21777
+ if (propDef._def.typeName === "ZodOptional") {
21740
21778
  propDef = propDef._def.innerType;
21741
21779
  }
21742
21780
  if (!propDef.isNullable()) {
@@ -21800,6 +21838,7 @@ var require_optional = __commonJS({
21800
21838
  Object.defineProperty(exports2, "__esModule", { value: true });
21801
21839
  exports2.parseOptionalDef = void 0;
21802
21840
  var parseDef_js_1 = require_parseDef();
21841
+ var any_js_1 = require_any();
21803
21842
  var parseOptionalDef = (def, refs) => {
21804
21843
  if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
21805
21844
  return (0, parseDef_js_1.parseDef)(def.innerType._def, refs);
@@ -21811,11 +21850,11 @@ var require_optional = __commonJS({
21811
21850
  return innerSchema ? {
21812
21851
  anyOf: [
21813
21852
  {
21814
- not: {}
21853
+ not: (0, any_js_1.parseAnyDef)(refs)
21815
21854
  },
21816
21855
  innerSchema
21817
21856
  ]
21818
- } : {};
21857
+ } : (0, any_js_1.parseAnyDef)(refs);
21819
21858
  };
21820
21859
  exports2.parseOptionalDef = parseOptionalDef;
21821
21860
  }
@@ -21937,9 +21976,10 @@ var require_undefined = __commonJS({
21937
21976
  "use strict";
21938
21977
  Object.defineProperty(exports2, "__esModule", { value: true });
21939
21978
  exports2.parseUndefinedDef = void 0;
21940
- function parseUndefinedDef() {
21979
+ var any_js_1 = require_any();
21980
+ function parseUndefinedDef(refs) {
21941
21981
  return {
21942
- not: {}
21982
+ not: (0, any_js_1.parseAnyDef)(refs)
21943
21983
  };
21944
21984
  }
21945
21985
  exports2.parseUndefinedDef = parseUndefinedDef;
@@ -21952,8 +21992,9 @@ var require_unknown = __commonJS({
21952
21992
  "use strict";
21953
21993
  Object.defineProperty(exports2, "__esModule", { value: true });
21954
21994
  exports2.parseUnknownDef = void 0;
21955
- function parseUnknownDef() {
21956
- return {};
21995
+ var any_js_1 = require_any();
21996
+ function parseUnknownDef(refs) {
21997
+ return (0, any_js_1.parseAnyDef)(refs);
21957
21998
  }
21958
21999
  exports2.parseUnknownDef = parseUnknownDef;
21959
22000
  }
@@ -22025,7 +22066,7 @@ var require_selectParser = __commonJS({
22025
22066
  case zod_1.ZodFirstPartyTypeKind.ZodDate:
22026
22067
  return (0, date_js_1.parseDateDef)(def, refs);
22027
22068
  case zod_1.ZodFirstPartyTypeKind.ZodUndefined:
22028
- return (0, undefined_js_1.parseUndefinedDef)();
22069
+ return (0, undefined_js_1.parseUndefinedDef)(refs);
22029
22070
  case zod_1.ZodFirstPartyTypeKind.ZodNull:
22030
22071
  return (0, null_js_1.parseNullDef)(refs);
22031
22072
  case zod_1.ZodFirstPartyTypeKind.ZodArray:
@@ -22059,13 +22100,13 @@ var require_selectParser = __commonJS({
22059
22100
  return (0, promise_js_1.parsePromiseDef)(def, refs);
22060
22101
  case zod_1.ZodFirstPartyTypeKind.ZodNaN:
22061
22102
  case zod_1.ZodFirstPartyTypeKind.ZodNever:
22062
- return (0, never_js_1.parseNeverDef)();
22103
+ return (0, never_js_1.parseNeverDef)(refs);
22063
22104
  case zod_1.ZodFirstPartyTypeKind.ZodEffects:
22064
22105
  return (0, effects_js_1.parseEffectsDef)(def, refs);
22065
22106
  case zod_1.ZodFirstPartyTypeKind.ZodAny:
22066
- return (0, any_js_1.parseAnyDef)();
22107
+ return (0, any_js_1.parseAnyDef)(refs);
22067
22108
  case zod_1.ZodFirstPartyTypeKind.ZodUnknown:
22068
- return (0, unknown_js_1.parseUnknownDef)();
22109
+ return (0, unknown_js_1.parseUnknownDef)(refs);
22069
22110
  case zod_1.ZodFirstPartyTypeKind.ZodDefault:
22070
22111
  return (0, default_js_1.parseDefaultDef)(def, refs);
22071
22112
  case zod_1.ZodFirstPartyTypeKind.ZodBranded:
@@ -22096,6 +22137,8 @@ var require_parseDef = __commonJS({
22096
22137
  exports2.parseDef = void 0;
22097
22138
  var Options_js_1 = require_Options();
22098
22139
  var selectParser_js_1 = require_selectParser();
22140
+ var getRelativePath_js_1 = require_getRelativePath();
22141
+ var any_js_1 = require_any();
22099
22142
  function parseDef(def, refs, forceResolution = false) {
22100
22143
  const seenItem = refs.seen.get(def);
22101
22144
  if (refs.override) {
@@ -22131,25 +22174,17 @@ var require_parseDef = __commonJS({
22131
22174
  case "root":
22132
22175
  return { $ref: item.path.join("/") };
22133
22176
  case "relative":
22134
- return { $ref: getRelativePath(refs.currentPath, item.path) };
22177
+ return { $ref: (0, getRelativePath_js_1.getRelativePath)(refs.currentPath, item.path) };
22135
22178
  case "none":
22136
22179
  case "seen": {
22137
22180
  if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
22138
22181
  console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
22139
- return {};
22182
+ return (0, any_js_1.parseAnyDef)(refs);
22140
22183
  }
22141
- return refs.$refStrategy === "seen" ? {} : void 0;
22184
+ return refs.$refStrategy === "seen" ? (0, any_js_1.parseAnyDef)(refs) : void 0;
22142
22185
  }
22143
22186
  }
22144
22187
  };
22145
- var getRelativePath = (pathA, pathB) => {
22146
- let i2 = 0;
22147
- for (; i2 < pathA.length && i2 < pathB.length; i2++) {
22148
- if (pathA[i2] !== pathB[i2])
22149
- break;
22150
- }
22151
- return [(pathA.length - i2).toString(), ...pathB.slice(i2)].join("/");
22152
- };
22153
22188
  var addMeta = (def, refs, jsonSchema) => {
22154
22189
  if (def.description) {
22155
22190
  jsonSchema.description = def.description;
@@ -22178,24 +22213,43 @@ var require_zodToJsonSchema = __commonJS({
22178
22213
  exports2.zodToJsonSchema = void 0;
22179
22214
  var parseDef_js_1 = require_parseDef();
22180
22215
  var Refs_js_1 = require_Refs();
22216
+ var any_js_1 = require_any();
22181
22217
  var zodToJsonSchema = (schema, options2) => {
22182
22218
  const refs = (0, Refs_js_1.getRefs)(options2);
22183
- const definitions = typeof options2 === "object" && options2.definitions ? Object.entries(options2.definitions).reduce((acc, [name2, schema2]) => ({
22219
+ let definitions = typeof options2 === "object" && options2.definitions ? Object.entries(options2.definitions).reduce((acc, [name2, schema2]) => ({
22184
22220
  ...acc,
22185
22221
  [name2]: (0, parseDef_js_1.parseDef)(schema2._def, {
22186
22222
  ...refs,
22187
22223
  currentPath: [...refs.basePath, refs.definitionPath, name2]
22188
- }, true) ?? {}
22224
+ }, true) ?? (0, any_js_1.parseAnyDef)(refs)
22189
22225
  }), {}) : void 0;
22190
22226
  const name = typeof options2 === "string" ? options2 : options2?.nameStrategy === "title" ? void 0 : options2?.name;
22191
22227
  const main = (0, parseDef_js_1.parseDef)(schema._def, name === void 0 ? refs : {
22192
22228
  ...refs,
22193
22229
  currentPath: [...refs.basePath, refs.definitionPath, name]
22194
- }, false) ?? {};
22230
+ }, false) ?? (0, any_js_1.parseAnyDef)(refs);
22195
22231
  const title = typeof options2 === "object" && options2.name !== void 0 && options2.nameStrategy === "title" ? options2.name : void 0;
22196
22232
  if (title !== void 0) {
22197
22233
  main.title = title;
22198
22234
  }
22235
+ if (refs.flags.hasReferencedOpenAiAnyType) {
22236
+ if (!definitions) {
22237
+ definitions = {};
22238
+ }
22239
+ if (!definitions[refs.openAiAnyTypeName]) {
22240
+ definitions[refs.openAiAnyTypeName] = {
22241
+ // Skipping "object" as no properties can be defined and additionalProperties must be "false"
22242
+ type: ["string", "number", "integer", "boolean", "array", "null"],
22243
+ items: {
22244
+ $ref: refs.$refStrategy === "relative" ? "1" : [
22245
+ ...refs.basePath,
22246
+ refs.definitionPath,
22247
+ refs.openAiAnyTypeName
22248
+ ].join("/")
22249
+ }
22250
+ };
22251
+ }
22252
+ }
22199
22253
  const combined = name === void 0 ? definitions ? {
22200
22254
  ...main,
22201
22255
  [refs.definitionPath]: definitions
@@ -22248,6 +22302,7 @@ var require_cjs2 = __commonJS({
22248
22302
  __exportStar2(require_Options(), exports2);
22249
22303
  __exportStar2(require_Refs(), exports2);
22250
22304
  __exportStar2(require_errorMessages(), exports2);
22305
+ __exportStar2(require_getRelativePath(), exports2);
22251
22306
  __exportStar2(require_parseDef(), exports2);
22252
22307
  __exportStar2(require_parseTypes(), exports2);
22253
22308
  __exportStar2(require_any(), exports2);
@@ -27853,9 +27908,9 @@ var require_lib = __commonJS({
27853
27908
  }
27854
27909
  });
27855
27910
 
27856
- // ../node_modules/isexe/windows.js
27911
+ // ../node_modules/cross-spawn/node_modules/which/node_modules/isexe/windows.js
27857
27912
  var require_windows = __commonJS({
27858
- "../node_modules/isexe/windows.js"(exports2, module2) {
27913
+ "../node_modules/cross-spawn/node_modules/which/node_modules/isexe/windows.js"(exports2, module2) {
27859
27914
  module2.exports = isexe;
27860
27915
  isexe.sync = sync;
27861
27916
  var fs9 = __require("fs");
@@ -27893,9 +27948,9 @@ var require_windows = __commonJS({
27893
27948
  }
27894
27949
  });
27895
27950
 
27896
- // ../node_modules/isexe/mode.js
27951
+ // ../node_modules/cross-spawn/node_modules/which/node_modules/isexe/mode.js
27897
27952
  var require_mode = __commonJS({
27898
- "../node_modules/isexe/mode.js"(exports2, module2) {
27953
+ "../node_modules/cross-spawn/node_modules/which/node_modules/isexe/mode.js"(exports2, module2) {
27899
27954
  module2.exports = isexe;
27900
27955
  isexe.sync = sync;
27901
27956
  var fs9 = __require("fs");
@@ -27926,9 +27981,9 @@ var require_mode = __commonJS({
27926
27981
  }
27927
27982
  });
27928
27983
 
27929
- // ../node_modules/isexe/index.js
27984
+ // ../node_modules/cross-spawn/node_modules/which/node_modules/isexe/index.js
27930
27985
  var require_isexe = __commonJS({
27931
- "../node_modules/isexe/index.js"(exports2, module2) {
27986
+ "../node_modules/cross-spawn/node_modules/which/node_modules/isexe/index.js"(exports2, module2) {
27932
27987
  var fs9 = __require("fs");
27933
27988
  var core;
27934
27989
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
@@ -27981,9 +28036,9 @@ var require_isexe = __commonJS({
27981
28036
  }
27982
28037
  });
27983
28038
 
27984
- // ../node_modules/which/which.js
28039
+ // ../node_modules/cross-spawn/node_modules/which/which.js
27985
28040
  var require_which = __commonJS({
27986
- "../node_modules/which/which.js"(exports2, module2) {
28041
+ "../node_modules/cross-spawn/node_modules/which/which.js"(exports2, module2) {
27987
28042
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
27988
28043
  var path11 = __require("path");
27989
28044
  var COLON = isWindows ? ";" : ":";
@@ -2,5 +2,5 @@
2
2
  * The build date used as the default worker compatibility date.
3
3
  * This is set to the date when the package was built.
4
4
  */
5
- export declare const BUILD_DATE = "2025-06-26";
5
+ export declare const BUILD_DATE = "2025-07-01";
6
6
  //# sourceMappingURL=build-date.d.ts.map
package/lib/build-date.js CHANGED
@@ -4,5 +4,5 @@
4
4
  * The build date used as the default worker compatibility date.
5
5
  * This is set to the date when the package was built.
6
6
  */
7
- export const BUILD_DATE = "2025-06-26";
7
+ export const BUILD_DATE = "2025-07-01";
8
8
  //# sourceMappingURL=build-date.js.map
@@ -0,0 +1,216 @@
1
+ import type { Context } from "../context.ts";
2
+ import { Resource } from "../resource.ts";
3
+ import { type CloudflareApi, type CloudflareApiOptions } from "./api.ts";
4
+ import type { Zone } from "./zone.ts";
5
+ /**
6
+ * Certificate Authority options for Advanced Certificate Packs
7
+ */
8
+ export type CertificateAuthority = "google" | "lets_encrypt" | "ssl_com";
9
+ /**
10
+ * Validation method for certificate verification
11
+ */
12
+ export type ValidationMethod = "txt" | "http" | "email";
13
+ /**
14
+ * Validity period options for certificates
15
+ */
16
+ export type ValidityDays = 14 | 30 | 90 | 365;
17
+ /**
18
+ * Certificate pack status values during lifecycle
19
+ */
20
+ export type CertificatePackStatus = "initializing" | "pending_validation" | "deleted" | "pending_issuance" | "pending_deployment" | "pending_deletion" | "pending_expiration" | "expired" | "active" | "initializing_timed_out" | "validation_timed_out" | "issuance_timed_out" | "deployment_timed_out" | "deletion_timed_out" | "pending_cleanup" | "staging_deployment" | "staging_active" | "deactivating" | "inactive" | "backup_issued" | "holding_deployment";
21
+ /**
22
+ * Properties for creating a Certificate Pack
23
+ */
24
+ export interface CertificatePackProps extends CloudflareApiOptions {
25
+ /**
26
+ * The zone to create the certificate pack for
27
+ * Can be a Zone resource, zone ID string, or omitted to auto-infer from hosts
28
+ */
29
+ zone?: string | Zone;
30
+ /**
31
+ * Certificate Authority to use for issuing the certificate
32
+ * - google: Google Trust Services (Enterprise features)
33
+ * - lets_encrypt: Let's Encrypt (Free, shorter validity periods)
34
+ * - ssl_com: SSL.com (Commercial certificates with extended validation)
35
+ *
36
+ * **Note:** This property is immutable after creation. To change the CA,
37
+ * you must delete and recreate the certificate pack.
38
+ */
39
+ certificateAuthority: CertificateAuthority;
40
+ /**
41
+ * List of hostnames to include in the certificate
42
+ * Maximum 50 hosts, must include the zone apex (root domain)
43
+ * Supports wildcards (e.g., "*.example.com")
44
+ *
45
+ * **Note:** This property is immutable after creation.
46
+ */
47
+ hosts: string[];
48
+ /**
49
+ * Certificate type - only "advanced" is supported
50
+ *
51
+ * **Note:** This property is immutable after creation.
52
+ * @default "advanced"
53
+ */
54
+ type?: "advanced";
55
+ /**
56
+ * Method used to validate domain ownership
57
+ * - txt: DNS TXT record validation
58
+ * - http: HTTP file validation
59
+ * - email: Email validation
60
+ *
61
+ * **Note:** This property is immutable after creation.
62
+ */
63
+ validationMethod: ValidationMethod;
64
+ /**
65
+ * Certificate validity period in days
66
+ * Available options: 14, 30, 90, or 365 days
67
+ *
68
+ * **Note:** This property is immutable after creation.
69
+ */
70
+ validityDays: ValidityDays;
71
+ /**
72
+ * Whether to add Cloudflare branding subdomain as Common Name
73
+ * Adds sni.cloudflaressl.com subdomain when enabled
74
+ *
75
+ * **Note:** This is the only property that can be updated after creation.
76
+ * @default false
77
+ */
78
+ cloudflareBranding?: boolean;
79
+ /**
80
+ * Whether to delete the certificate pack
81
+ * If set to false, the pack will remain but the resource will be removed from state
82
+ *
83
+ * @default true
84
+ */
85
+ delete?: boolean;
86
+ }
87
+ /**
88
+ * Output returned after Certificate Pack creation/update
89
+ */
90
+ export interface CertificatePack extends Resource<"cloudflare::CertificatePack"> {
91
+ /**
92
+ * The unique ID of the certificate pack
93
+ */
94
+ id: string;
95
+ /**
96
+ * Certificate Authority used for the certificate
97
+ */
98
+ certificateAuthority: CertificateAuthority;
99
+ /**
100
+ * Whether Cloudflare branding is enabled
101
+ */
102
+ cloudflareBranding: boolean;
103
+ /**
104
+ * List of hostnames included in the certificate
105
+ */
106
+ hosts: string[];
107
+ /**
108
+ * Current status of the certificate pack
109
+ */
110
+ status: CertificatePackStatus;
111
+ /**
112
+ * Certificate type
113
+ */
114
+ type: "advanced";
115
+ /**
116
+ * Validation method used for domain verification
117
+ */
118
+ validationMethod: ValidationMethod;
119
+ /**
120
+ * Certificate validity period in days
121
+ */
122
+ validityDays: ValidityDays;
123
+ /**
124
+ * Zone ID the certificate pack belongs to
125
+ */
126
+ zoneId: string;
127
+ /**
128
+ * Zone name (domain)
129
+ */
130
+ zoneName: string;
131
+ }
132
+ /**
133
+ * Creates and manages Cloudflare Advanced Certificate Packs.
134
+ *
135
+ * Advanced Certificate Packs provide flexible SSL/TLS certificates with
136
+ * multiple Certificate Authority options, custom validity periods, and
137
+ * support for up to 50 hostnames per certificate.
138
+ *
139
+ * **Important Notes:**
140
+ * - Requires a paid Cloudflare plan (not available on Free plans)
141
+ * - Certificate provisioning can take up to 10 minutes
142
+ * - Most properties are immutable after creation (only cloudflareBranding can be updated)
143
+ * - To change immutable properties, you must delete and recreate the certificate pack
144
+ *
145
+ * @example
146
+ * // Create a basic certificate pack with Let's Encrypt
147
+ * const basicCert = await CertificatePack("my-cert", {
148
+ * zone: myZone,
149
+ * certificateAuthority: "lets_encrypt",
150
+ * hosts: ["example.com", "www.example.com"],
151
+ * validationMethod: "txt",
152
+ * validityDays: 90
153
+ * });
154
+ *
155
+ * @example
156
+ * // Create an enterprise certificate with Google Trust Services
157
+ * const enterpriseCert = await CertificatePack("enterprise-cert", {
158
+ * zone: "example.com",
159
+ * certificateAuthority: "google",
160
+ * hosts: ["example.com", "*.example.com", "api.example.com"],
161
+ * validationMethod: "txt",
162
+ * validityDays: 365,
163
+ * cloudflareBranding: true
164
+ * });
165
+ *
166
+ * @example
167
+ * // Create a wildcard certificate with SSL.com
168
+ * const wildcardCert = await CertificatePack("wildcard-cert", {
169
+ * zone: myZone,
170
+ * certificateAuthority: "ssl_com",
171
+ * hosts: ["example.com", "*.example.com"],
172
+ * validationMethod: "email",
173
+ * validityDays: 365
174
+ * });
175
+ *
176
+ * @example
177
+ * // Create a certificate for multiple subdomains
178
+ * const multiDomainCert = await CertificatePack("multi-cert", {
179
+ * zone: "example.com",
180
+ * certificateAuthority: "lets_encrypt",
181
+ * hosts: [
182
+ * "example.com",
183
+ * "www.example.com",
184
+ * "api.example.com",
185
+ * "admin.example.com",
186
+ * "blog.example.com"
187
+ * ],
188
+ * validationMethod: "http",
189
+ * validityDays: 90
190
+ * });
191
+ *
192
+ * @see https://developers.cloudflare.com/api/resources/ssl/subresources/certificate_packs/
193
+ */
194
+ export declare const CertificatePack: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<CertificatePack>, _id: string, props: CertificatePackProps) => Promise<CertificatePack>);
195
+ /**
196
+ * Helper function to wait for certificate pack to reach active status
197
+ * Useful for testing or when you need to ensure the certificate is ready
198
+ *
199
+ * @param api CloudflareApi instance
200
+ * @param zoneId Zone ID
201
+ * @param certificatePackId Certificate pack ID
202
+ * @param timeoutMs Maximum time to wait in milliseconds (default: 15 minutes)
203
+ * @returns Promise resolving to the final certificate pack status
204
+ *
205
+ * @example
206
+ * // Wait for certificate to become active
207
+ * const finalStatus = await waitForCertificatePackActive(
208
+ * api,
209
+ * zoneId,
210
+ * certificatePack.id,
211
+ * 10 * 60 * 1000 // 10 minutes
212
+ * );
213
+ * console.log(`Certificate pack is now: ${finalStatus}`);
214
+ */
215
+ export declare function waitForCertificatePackActive(api: CloudflareApi, zoneId: string, certificatePackId: string, timeoutMs?: number): Promise<CertificatePackStatus>;
216
+ //# sourceMappingURL=certificate-pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certificate-pack.d.ts","sourceRoot":"","sources":["../../src/cloudflare/certificate-pack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,IAA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