@void/deploy-core 0.24.0 → 0.26.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.
package/README.md CHANGED
@@ -1,18 +1,7 @@
1
1
  # @void/deploy-core
2
2
 
3
- Shared deployment contracts for the Void SDK and hosted Void platform.
3
+ Shared deployment contracts for Void runtimes and deployment adapters. Includes manifests, progress events, routing rules, resource plans, and SQL and Durable Object migration metadata.
4
4
 
5
- This package owns the wire types exchanged by the `void` CLI and the managed
6
- platform, including deployment manifests, progress events, assets, routing
7
- rules, queues, append-only Durable Object migration planning and metadata, normalized upload artifacts, runtime
8
- manifest validation, and provider-neutral resource planning. It has no
9
- dependency on either deployment target and must remain usable from Node.js and
10
- Cloudflare Workers.
5
+ This package works in Node.js and Cloudflare Workers. Applications normally use the `void` CLI rather than these contracts directly.
11
6
 
12
- SQL migration tokenization, classification, and canonical hash inputs are shared
13
- here. Each target supplies its hashing implementation and independently validates
14
- submitted plans; CLI execution policy stays in the CLI.
15
-
16
- The package also defines the adapter boundary implemented by deployment
17
- targets. Target-specific orchestration belongs in `void` or `platform/`, not
18
- here.
7
+ See [Deployment](https://void.cloud/guide/deployment) for deploying an app and [Platform Development](https://void.cloud/guide/platform-development) for working on a runtime or adapter.
package/dist/index.d.mts CHANGED
@@ -169,6 +169,10 @@ export declare function createDeployUploadPayload(artifact: DeployArtifact, meta
169
169
  //#region src/canonical-json.d.ts
170
170
  export declare function canonicalJson(value: unknown): string;
171
171
  //#endregion
172
+ //#region src/is-record.d.ts
173
+ /** Narrow object-shaped input without accepting null or arrays. */
174
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
175
+ //#endregion
172
176
  //#region src/sql-tokenize.d.ts
173
177
  /**
174
178
  * Char-by-char SQL tokenizer shared by the destructive-SQL guard
@@ -243,6 +247,12 @@ type MigrationPlanHashInput = SqlMigrationClassification & {
243
247
  export declare function canonicalSql(sql: string): string;
244
248
  export declare function hasStandalonePragma(sql: string, pragma: string): boolean;
245
249
  export declare function isSingleStatement(sql: string): boolean;
250
+ /**
251
+ * Split SQL on top-level semicolons, ignoring literals and comments. Returns
252
+ * null when a statement may contain a compound `BEGIN ... END` body (such as
253
+ * CREATE TRIGGER), whose inner semicolons cannot be told apart lexically.
254
+ */
255
+ export declare function splitSqlStatements(sql: string): Array<string> | null;
246
256
  /** Classify SQL without imposing the caller's execution policy or hashing implementation. */
247
257
  export declare function classifySqlMigration(sql: string): SqlMigrationClassification;
248
258
  /** Preserve the classifier-v1 hash preimage; policy markers and warnings are not hashed. */
package/dist/index.mjs CHANGED
@@ -407,6 +407,12 @@ function canonicalJson(value) {
407
407
  throw new TypeError(`Unsupported canonical JSON value: ${typeof value}`);
408
408
  }
409
409
  //#endregion
410
+ //#region src/is-record.ts
411
+ /** Narrow object-shaped input without accepting null or arrays. */
412
+ function isRecord(value) {
413
+ return typeof value === "object" && value !== null && !Array.isArray(value);
414
+ }
415
+ //#endregion
410
416
  //#region src/sql-tokenize.ts
411
417
  function* tokenizeSql(sql) {
412
418
  const sqlLength = sql.length;
@@ -546,30 +552,57 @@ function hasStatementBreakpointOutsideLiterals(sql) {
546
552
  }
547
553
  return false;
548
554
  }
549
- function isSingleStatement(sql) {
555
+ function scanStatements(sql) {
550
556
  const normalized = canonicalSql(sql);
551
- let statements = 0;
557
+ const ranges = [];
558
+ let cursor = 0;
552
559
  let inStatement = false;
560
+ let hasCompoundBody = false;
553
561
  for (const segment of tokenizeSql(normalized)) {
554
562
  if (segment.kind === "line-comment" || segment.kind === "block-comment") continue;
555
563
  if (segment.kind === "string" || segment.kind === "ident-quote") {
556
564
  inStatement = true;
557
565
  continue;
558
566
  }
567
+ if (/\b(?:BEGIN|TRIGGER)\b/i.test(normalized.slice(segment.start, segment.end))) hasCompoundBody = true;
559
568
  for (let index = segment.start; index < segment.end; index++) {
560
569
  const character = normalized[index];
561
570
  if (character === ";") {
562
571
  if (inStatement) {
563
- statements++;
572
+ ranges.push({
573
+ start: cursor,
574
+ end: index + 1
575
+ });
564
576
  inStatement = false;
565
577
  }
578
+ cursor = index + 1;
566
579
  continue;
567
580
  }
568
581
  if (character !== " " && character !== " " && character !== "\n" && character !== "\r") inStatement = true;
569
582
  }
570
583
  }
571
- if (inStatement) statements++;
572
- return statements === 1;
584
+ if (inStatement) ranges.push({
585
+ start: cursor,
586
+ end: normalized.length
587
+ });
588
+ return {
589
+ normalized,
590
+ ranges,
591
+ hasCompoundBody
592
+ };
593
+ }
594
+ function isSingleStatement(sql) {
595
+ return scanStatements(sql).ranges.length === 1;
596
+ }
597
+ /**
598
+ * Split SQL on top-level semicolons, ignoring literals and comments. Returns
599
+ * null when a statement may contain a compound `BEGIN ... END` body (such as
600
+ * CREATE TRIGGER), whose inner semicolons cannot be told apart lexically.
601
+ */
602
+ function splitSqlStatements(sql) {
603
+ const { normalized, ranges, hasCompoundBody } = scanStatements(sql);
604
+ if (hasCompoundBody) return null;
605
+ return ranges.map((range) => normalized.slice(range.start, range.end).trim());
573
606
  }
574
607
  /** Classify SQL without imposing the caller's execution policy or hashing implementation. */
575
608
  function classifySqlMigration(sql) {
@@ -682,4 +715,4 @@ function isSandboxRegistryImage(image) {
682
715
  return /^registry\.cloudflare\.com\/[^/@\s]+\/[^@\s]+@sha256:[a-f\d]{64}$/.test(image);
683
716
  }
684
717
  //#endregion
685
- export { DEPLOY_ARTIFACT_VERSION, MANIFEST_REDIRECT_RULE_STATUSES, MAX_REVALIDATE_QUERY_ALLOWLIST_ENTRIES, MAX_ROUTING_RULES, MIGRATION_CLASSIFIER_VERSION, SUPPORTED_MANIFEST_VERSIONS, UNSPLIT_MULTI_STATEMENT_PRAGMA, appendSqliteClassMigration, canonicalJson, canonicalSql, classifySqlMigration, createDeployArtifact, createDeployIntent, createDeployResourcePlan, createDeployUploadPayload, getMigrationPlanHashInput, hasStandalonePragma, isSandboxRegistryImage, isSingleStatement, planWebSocketMigrations, tokenizeSql, validateManifestShape };
718
+ export { DEPLOY_ARTIFACT_VERSION, MANIFEST_REDIRECT_RULE_STATUSES, MAX_REVALIDATE_QUERY_ALLOWLIST_ENTRIES, MAX_ROUTING_RULES, MIGRATION_CLASSIFIER_VERSION, SUPPORTED_MANIFEST_VERSIONS, UNSPLIT_MULTI_STATEMENT_PRAGMA, appendSqliteClassMigration, canonicalJson, canonicalSql, classifySqlMigration, createDeployArtifact, createDeployIntent, createDeployResourcePlan, createDeployUploadPayload, getMigrationPlanHashInput, hasStandalonePragma, isRecord, isSandboxRegistryImage, isSingleStatement, planWebSocketMigrations, splitSqlStatements, tokenizeSql, validateManifestShape };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/deploy-core",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voidzero-dev/void.git",