@lunora/server 1.0.0-alpha.188 → 1.0.0-alpha.189

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/dist/types.d.mts CHANGED
@@ -1818,6 +1818,29 @@ interface WorkflowStatusResult {
1818
1818
  output?: unknown;
1819
1819
  status: WorkflowInstanceStatus;
1820
1820
  }
1821
+ /** Options accepted by {@link WorkflowHandle.createBatch}: explicit `instances`, or `count` sharing one `params`/`retention`. Mirrors `@lunora/workflow`'s `WorkflowCreateBatchOptions`. */
1822
+ type WorkflowCreateBatchOptions<Params = Record<string, unknown>> = {
1823
+ instances: ReadonlyArray<WorkflowCreateOptions<Params>>;
1824
+ } | {
1825
+ count: number;
1826
+ params?: Params;
1827
+ retention?: {
1828
+ errorRetention?: string;
1829
+ successRetention?: string;
1830
+ };
1831
+ };
1832
+ /** One instance a batch did not create; `index` is its input position. Mirrors `@lunora/workflow`'s `WorkflowCreateBatchError`. */
1833
+ interface WorkflowCreateBatchError {
1834
+ code: number;
1835
+ id?: string;
1836
+ index: number;
1837
+ message: string;
1838
+ }
1839
+ /** Result of {@link WorkflowHandle.createBatch}. Mirrors `@lunora/workflow`'s `WorkflowCreateBatchResult`. */
1840
+ interface WorkflowCreateBatchResult {
1841
+ created: WorkflowInstance[];
1842
+ errors: WorkflowCreateBatchError[];
1843
+ }
1821
1844
  /** Options accepted by {@link WorkflowHandle.create}. Mirrors `@lunora/workflow`'s `WorkflowCreateOptions`. */
1822
1845
  interface WorkflowCreateOptions<Params = Record<string, unknown>> {
1823
1846
  /** Unique-within-the-workflow instance id. Generated by Cloudflare when omitted. */
@@ -1876,8 +1899,8 @@ interface WorkflowInstance {
1876
1899
  interface WorkflowHandle<Params = Record<string, unknown>> {
1877
1900
  /** Start a new instance (optionally with an id + params). */
1878
1901
  create: (options?: WorkflowCreateOptions<Params>) => Promise<WorkflowInstance>;
1879
- /** Start many instances in one batched RPC. */
1880
- createBatch: (batch: ReadonlyArray<WorkflowCreateOptions<Params>>) => Promise<WorkflowInstance[]>;
1902
+ /** Start many instances in one batched RPC; per-instance failures come back in `errors`, not dropped. */
1903
+ createBatch: (options: WorkflowCreateBatchOptions<Params>) => Promise<WorkflowCreateBatchResult>;
1881
1904
  /** Delete up to 100 instances and their stored state; ids that do not exist come back as per-instance errors. */
1882
1905
  deleteBatch: (instanceIds: ReadonlyArray<string>) => Promise<{
1883
1906
  deleted: {
package/dist/types.d.ts CHANGED
@@ -1818,6 +1818,29 @@ interface WorkflowStatusResult {
1818
1818
  output?: unknown;
1819
1819
  status: WorkflowInstanceStatus;
1820
1820
  }
1821
+ /** Options accepted by {@link WorkflowHandle.createBatch}: explicit `instances`, or `count` sharing one `params`/`retention`. Mirrors `@lunora/workflow`'s `WorkflowCreateBatchOptions`. */
1822
+ type WorkflowCreateBatchOptions<Params = Record<string, unknown>> = {
1823
+ instances: ReadonlyArray<WorkflowCreateOptions<Params>>;
1824
+ } | {
1825
+ count: number;
1826
+ params?: Params;
1827
+ retention?: {
1828
+ errorRetention?: string;
1829
+ successRetention?: string;
1830
+ };
1831
+ };
1832
+ /** One instance a batch did not create; `index` is its input position. Mirrors `@lunora/workflow`'s `WorkflowCreateBatchError`. */
1833
+ interface WorkflowCreateBatchError {
1834
+ code: number;
1835
+ id?: string;
1836
+ index: number;
1837
+ message: string;
1838
+ }
1839
+ /** Result of {@link WorkflowHandle.createBatch}. Mirrors `@lunora/workflow`'s `WorkflowCreateBatchResult`. */
1840
+ interface WorkflowCreateBatchResult {
1841
+ created: WorkflowInstance[];
1842
+ errors: WorkflowCreateBatchError[];
1843
+ }
1821
1844
  /** Options accepted by {@link WorkflowHandle.create}. Mirrors `@lunora/workflow`'s `WorkflowCreateOptions`. */
1822
1845
  interface WorkflowCreateOptions<Params = Record<string, unknown>> {
1823
1846
  /** Unique-within-the-workflow instance id. Generated by Cloudflare when omitted. */
@@ -1876,8 +1899,8 @@ interface WorkflowInstance {
1876
1899
  interface WorkflowHandle<Params = Record<string, unknown>> {
1877
1900
  /** Start a new instance (optionally with an id + params). */
1878
1901
  create: (options?: WorkflowCreateOptions<Params>) => Promise<WorkflowInstance>;
1879
- /** Start many instances in one batched RPC. */
1880
- createBatch: (batch: ReadonlyArray<WorkflowCreateOptions<Params>>) => Promise<WorkflowInstance[]>;
1902
+ /** Start many instances in one batched RPC; per-instance failures come back in `errors`, not dropped. */
1903
+ createBatch: (options: WorkflowCreateBatchOptions<Params>) => Promise<WorkflowCreateBatchResult>;
1881
1904
  /** Delete up to 100 instances and their stored state; ids that do not exist come back as per-instance errors. */
1882
1905
  deleteBatch: (instanceIds: ReadonlyArray<string>) => Promise<{
1883
1906
  deleted: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/server",
3
- "version": "1.0.0-alpha.188",
3
+ "version": "1.0.0-alpha.189",
4
4
  "description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
5
5
  "keywords": [
6
6
  "backend",