@alienplatform/sdk 2.1.6 → 3.0.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/dist/dist.js +48 -26
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/worker-runtime/registry.d.ts +32 -3
- package/dist/worker-runtime/registry.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/dist.js
CHANGED
|
@@ -17,29 +17,20 @@ function registry$1() {
|
|
|
17
17
|
}
|
|
18
18
|
return state;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* The handler receives the decoded params and, optionally, a
|
|
24
|
-
* {@link WorkerCommandContext} with `commandId`, `attempt`, and `deadline` —
|
|
25
|
-
* use `attempt` to make redeliveries idempotent (at-least-once semantics).
|
|
26
|
-
*
|
|
27
|
-
* @param name - Command name
|
|
28
|
-
* @param handler - Handler that receives params (and optionally the context)
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* import { command } from "@alienplatform/sdk"
|
|
33
|
-
*
|
|
34
|
-
* command("echo", async ({ message }: { message: string }, { attempt }) => {
|
|
35
|
-
* return { message, attempt, timestamp: new Date().toISOString() }
|
|
36
|
-
* })
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
function command(name, handler) {
|
|
20
|
+
function command(name, schemaOrHandler, validatedHandler) {
|
|
21
|
+
const schema = validatedHandler === void 0 ? void 0 : schemaOrHandler;
|
|
22
|
+
const handler = validatedHandler ?? schemaOrHandler;
|
|
40
23
|
registry$1().commands.set(name, {
|
|
41
24
|
name,
|
|
42
|
-
handler
|
|
25
|
+
handler: async (params, context) => {
|
|
26
|
+
if (schema === void 0) return await handler(params, context);
|
|
27
|
+
const result = await schema["~standard"].validate(params);
|
|
28
|
+
if (result.issues !== void 0) {
|
|
29
|
+
const details = result.issues.map((issue) => issue.message).join("; ");
|
|
30
|
+
throw new Error(`Command input failed validation${details ? `: ${details}` : ""}`);
|
|
31
|
+
}
|
|
32
|
+
return await handler(result.value, context);
|
|
33
|
+
}
|
|
43
34
|
});
|
|
44
35
|
}
|
|
45
36
|
/** Get all registered commands. @internal */
|
|
@@ -5139,7 +5130,7 @@ const AwsEmailDomainImportDataSchema = object({ get "dkimTokens"() {
|
|
|
5139
5130
|
object({
|
|
5140
5131
|
"configurationSet": string().describe("SES configuration set name (used when sending)."),
|
|
5141
5132
|
"domains": object({}).catchall(lazy(() => AwsEmailDomainImportDataSchema).describe("Per-domain import payload for an AWS Email resource.")).describe("Per-seed-domain DNS data, keyed by mail domain."),
|
|
5142
|
-
"ruleSetName": string().describe("SES receipt rule set name, present only when inbound mail is
|
|
5133
|
+
"ruleSetName": string().describe("SES receipt rule set name, present only when inbound mail is configured.").nullish()
|
|
5143
5134
|
}).describe("AWS Email ImportData.\n\nMirrors the `emit_import_ref` payload of the AWS SES email emitter: the\nshared configuration set name, one entry per seed domain carrying its\nEasy-DKIM CNAME records, and — when inbound mail is configured — the\nreceipt rule set name. Identities created at runtime through the\n`email/manage-identities` grant are application data and never appear\nhere.");
|
|
5144
5135
|
/**
|
|
5145
5136
|
* Generated by Kubb (https://kubb.dev/).
|
|
@@ -5258,6 +5249,32 @@ object({
|
|
|
5258
5249
|
* Do not edit manually.
|
|
5259
5250
|
*/
|
|
5260
5251
|
/**
|
|
5252
|
+
* @description Minimum and maximum OCU bounds for one OpenSearch compute component.
|
|
5253
|
+
*/
|
|
5254
|
+
const AwsOpenSearchCapacityRangeSchema = object({
|
|
5255
|
+
"maxOcu": int().min(2).max(1696).describe("Maximum OCUs the component may scale to.").nullish(),
|
|
5256
|
+
"minOcu": int().min(0).max(1696).describe("Minimum OCUs kept available. Zero enables scale-to-zero.").nullish()
|
|
5257
|
+
}).describe("Minimum and maximum OCU bounds for one OpenSearch compute component.");
|
|
5258
|
+
/**
|
|
5259
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
5260
|
+
* Do not edit manually.
|
|
5261
|
+
*/
|
|
5262
|
+
/**
|
|
5263
|
+
* @description Indexing and search capacity limits for an OpenSearch collection group.
|
|
5264
|
+
*/
|
|
5265
|
+
const AwsOpenSearchCapacitySchema = object({
|
|
5266
|
+
get "indexing"() {
|
|
5267
|
+
return union([AwsOpenSearchCapacityRangeSchema, _null()]).optional();
|
|
5268
|
+
},
|
|
5269
|
+
get "search"() {
|
|
5270
|
+
return union([AwsOpenSearchCapacityRangeSchema, _null()]).optional();
|
|
5271
|
+
}
|
|
5272
|
+
}).describe("Indexing and search capacity limits for an OpenSearch collection group.");
|
|
5273
|
+
/**
|
|
5274
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
5275
|
+
* Do not edit manually.
|
|
5276
|
+
*/
|
|
5277
|
+
/**
|
|
5261
5278
|
* @description Workload type for an OpenSearch Serverless collection.\n\n`TIMESERIES` is intentionally not exposed: next-generation serverless\nscale-to-zero targets search and vector workloads.
|
|
5262
5279
|
*/
|
|
5263
5280
|
const AwsOpenSearchCollectionTypeSchema = _enum(["search", "vectorSearch"]).describe("Workload type for an OpenSearch Serverless collection.\n\n`TIMESERIES` is intentionally not exposed: next-generation serverless\nscale-to-zero targets search and vector workloads.");
|
|
@@ -5272,11 +5289,14 @@ object({
|
|
|
5272
5289
|
"endpoint": string().describe("Collection endpoint (`https://<collectionId>.aoss.<region>.on.aws`).\nRequests must be SigV4-signed with service name `aoss`.")
|
|
5273
5290
|
}).describe("Outputs generated by a successfully provisioned AwsOpenSearch collection.\n\nNext-generation collections expose no OpenSearch Dashboards endpoint\n(the `DashboardEndpoint` attribute exists only for classic collections),\nso only the data-plane endpoint and ARN are surfaced.");
|
|
5274
5291
|
object({
|
|
5292
|
+
get "capacity"() {
|
|
5293
|
+
return union([AwsOpenSearchCapacitySchema, _null()]).optional();
|
|
5294
|
+
},
|
|
5275
5295
|
get "collectionType"() {
|
|
5276
5296
|
return AwsOpenSearchCollectionTypeSchema.describe("Workload type for an OpenSearch Serverless collection.\n\n`TIMESERIES` is intentionally not exposed: next-generation serverless\nscale-to-zero targets search and vector workloads.").optional();
|
|
5277
5297
|
},
|
|
5278
5298
|
"id": string().describe("Identifier for the collection. Becomes part of the physical collection\nname, so it must match `[a-z][a-z0-9-]*` and be at most 23 characters.")
|
|
5279
|
-
}).describe("An Amazon OpenSearch Serverless collection (next generation).\n\n# Experimental namespace\n\nThis is the first resource under the `experimental/` resource-type\nnamespace. Experimental resources are provider-specific (they do not\nabstract over clouds), may change or be promoted to a portable resource\nin a breaking way, and are only registered for the platforms they\nsupport. `AwsOpenSearch` registers an AWS CloudFormation emitter only;\ndeploying it to any other platform fails with a typed\n`ImportRegistrationMissing` error at generation time.\n\n# What gets provisioned\n\nThe AWS emitter provisions next-generation OpenSearch Serverless:\na collection group (`Generation: NEXTGEN`, compute/storage decoupled
|
|
5299
|
+
}).describe("An Amazon OpenSearch Serverless collection (next generation).\n\n# Experimental namespace\n\nThis is the first resource under the `experimental/` resource-type\nnamespace. Experimental resources are provider-specific (they do not\nabstract over clouds), may change or be promoted to a portable resource\nin a breaking way, and are only registered for the platforms they\nsupport. `AwsOpenSearch` registers an AWS CloudFormation emitter only;\ndeploying it to any other platform fails with a typed\n`ImportRegistrationMissing` error at generation time.\n\n# What gets provisioned\n\nThe AWS emitter provisions next-generation OpenSearch Serverless:\na collection group (`Generation: NEXTGEN`, compute/storage decoupled)\nplus a collection inside it, an AWS-owned-key encryption configuration,\na public network policy, and a data-access policy for service-account\nroles granted `experimental/aws-opensearch/data-access`. Collection groups\nscale to zero by default; configure a non-zero minimum capacity when the\nworkload requires predictable interactive latency.\nThe collection endpoint is public but every request must be SigV4-signed\nand pass both IAM (`aoss:APIAccessAll`) and the data-access policy.\n\n# Naming\n\nThe physical collection (and collection group) name is\n`{id}-{stack-suffix}` and must satisfy the AOSS name grammar, so `id`\nmust match `[a-z][a-z0-9-]*` and be at most 23 characters. The emitter\nrejects ids that don't fit.\n\n# Runtime access\n\nWorkers reach the collection over HTTPS with SigV4. The SigV4 signing\nservice name for OpenSearch Serverless is `aoss` (not `es`); the runtime\nbinding payload carries `\"service\": \"aoss\"` so clients sign correctly.\nRequests with a body must also send an `x-amz-content-sha256` header\n(the AOSS gateway rejects body-carrying requests without it with an\nempty 403); official OpenSearch clients with an `aoss` signer handle\nthis automatically.");
|
|
5280
5300
|
/**
|
|
5281
5301
|
* Generated by Kubb (https://kubb.dev/).
|
|
5282
5302
|
* Do not edit manually.
|
|
@@ -7700,7 +7720,7 @@ const EmailInboundSchema = object({ get "storage"() {
|
|
|
7700
7720
|
object({
|
|
7701
7721
|
"configurationSet": string().describe("The provisioned configuration set name (used when sending)."),
|
|
7702
7722
|
"domains": object({}).catchall(lazy(() => EmailDomainOutputsSchema).describe("Per-domain DNS records the operator must create.")).describe("DNS records per mail domain."),
|
|
7703
|
-
"ruleSetName": string().describe("The inbound receipt rule set name, when `inbound` is configured
|
|
7723
|
+
"ruleSetName": string().describe("The inbound receipt rule set name, when `inbound` is configured.").nullish()
|
|
7704
7724
|
}).describe("Outputs generated by a successfully provisioned Email resource.\n\nDomain verification status cannot be known at provisioning time — SES\nverifies a domain asynchronously once its DKIM records exist in DNS — so\nthe outputs carry the records the operator must create rather than a\nverification result.");
|
|
7705
7725
|
object({
|
|
7706
7726
|
"domains": optional(array(string()).describe("Seed mail domains provisioned at deploy time (one SES identity each).\nUseful for day-0 bootstrap and products with a static domain set.\nMay be empty (the default): products that create and verify domains\ndynamically should manage identities at runtime through the\n`email/manage-identities` grant instead of listing them here.")),
|
|
@@ -7711,7 +7731,7 @@ object({
|
|
|
7711
7731
|
get "inbound"() {
|
|
7712
7732
|
return union([EmailInboundSchema, _null()]).optional();
|
|
7713
7733
|
}
|
|
7714
|
-
}).describe("Email infrastructure for sending and receiving mail on customer-owned\ndomains. On AWS this is backed by SES: a shared configuration set, optional\ninbound/event wiring, and one email identity (Easy DKIM) per seed domain.\n\n# Infrastructure vs runtime data\n\nThis resource owns the email *infrastructure* and the capability to use it,\nnot the domain lifecycle. Deployment manages the configuration set, the\nevent topology, the inbound receipt topology, and any seed identities\nlisted in `domains`. Email identities created at runtime through the\n`email/manage-identities` grant are application data: they are not tracked\nby the deployment, are not removed when the stack is deleted, and their\nlifecycle — including deletion — belongs to the application.\n\nThe operator (or the application, for runtime-created identities) owns DNS:\nthe per-domain DKIM CNAME records surfaced in [`EmailOutputs`] must be\ncreated before SES verifies a domain and allows sending from it.\n\n# Inbound mail (AWS)\n\nWhen `inbound` is set, a SES receipt rule set is provisioned that writes\nraw incoming mail into the linked Storage bucket. The receipt rule is a\ncatch-all (no recipient filter), so mail for identities verified at runtime\nlands in the bucket without any infrastructure change
|
|
7734
|
+
}).describe("Email infrastructure for sending and receiving mail on customer-owned\ndomains. On AWS this is backed by SES: a shared configuration set, optional\ninbound/event wiring, and one email identity (Easy DKIM) per seed domain.\n\n# Infrastructure vs runtime data\n\nThis resource owns the email *infrastructure* and the capability to use it,\nnot the domain lifecycle. Deployment manages the configuration set, the\nevent topology, the inbound receipt topology, and any seed identities\nlisted in `domains`. Email identities created at runtime through the\n`email/manage-identities` grant are application data: they are not tracked\nby the deployment, are not removed when the stack is deleted, and their\nlifecycle — including deletion — belongs to the application.\n\nThe operator (or the application, for runtime-created identities) owns DNS:\nthe per-domain DKIM CNAME records surfaced in [`EmailOutputs`] must be\ncreated before SES verifies a domain and allows sending from it.\n\n# Inbound mail (AWS)\n\nWhen `inbound` is set, a SES receipt rule set is provisioned that writes\nraw incoming mail into the linked Storage bucket. The receipt rule is a\ncatch-all (no recipient filter), so mail for identities verified at runtime\nlands in the bucket without any infrastructure change.\n\nAlien activates the provisioned receipt rule set as part of setup. Because\nSES permits only one active receipt rule set per AWS account and region, an\nAWS stack may contain only one email resource with inbound delivery, and\ninstalling it makes its rule set the account's active rule set. SES email\nreceiving is available only in a subset of AWS regions; deploying `inbound`\nto an unsupported region fails during setup.\n\n# Update semantics\n\n`domains` is append-friendly: adding a domain provisions a new identity,\nremoving a domain deletes its identity (and its DKIM verification state).\nThe list may be empty. `inbound` and `events` may be added, removed, or\nrepointed; removing them tears down the corresponding receipt rule set /\nevent destination wiring.");
|
|
7715
7735
|
/**
|
|
7716
7736
|
* Generated by Kubb (https://kubb.dev/).
|
|
7717
7737
|
* Do not edit manually.
|
|
@@ -8997,6 +9017,7 @@ const ResourceEntrySchema = object({
|
|
|
8997
9017
|
get "dependencies"() {
|
|
8998
9018
|
return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("Additional dependencies for this resource beyond those defined in the resource itself.\nThe total dependencies are: resource.get_dependencies() + this list");
|
|
8999
9019
|
},
|
|
9020
|
+
"enabledWhen": string().describe("Id of the boolean stack input that decides whether this resource is\ncreated at all. `None` means always create it.\n\nSet by `.enabled(input)` in the SDK. Setup emitters render the resource\nconditionally on the matching template variable, so a deployer who says no\nnever gets the resource, its outputs, or anything derived from it.").nullish(),
|
|
9000
9021
|
get "lifecycle"() {
|
|
9001
9022
|
return ResourceLifecycleSchema.describe("Describes the lifecycle of a resource within a stack, determining how it's managed and deployed.");
|
|
9002
9023
|
},
|
|
@@ -9486,6 +9507,7 @@ const StorageEventSchema = object({
|
|
|
9486
9507
|
array(lazy(() => StorageEventSchema).describe("Represents an event triggered by an action in an object storage service.\n\nThis struct provides a generic representation for events from services like\nAWS S3, Google Cloud Storage (GCS), and Azure Blob Storage.")).describe("A wrapper type for a list of storage events.");
|
|
9487
9508
|
object({ "bucketName": string().describe("The globally unique name of the bucket.") }).describe("Outputs generated by a successfully provisioned Storage bucket.");
|
|
9488
9509
|
object({
|
|
9510
|
+
"corsAllowedOrigins": optional(array(string()).describe("Browser origins allowed to read objects through signed URLs.\n\nWhen non-empty, providers configure CORS for `GET` and `HEAD` requests.\nAn origin of `*` is appropriate for private buckets whose signed URLs\nare bearer credentials and do not use browser cookies.\nDefault: `[]` (CORS disabled).")),
|
|
9489
9511
|
"id": string().describe("Name of the the storage bucket.\nFor names with dots, each dot-separated label must be ≤ 63 characters."),
|
|
9490
9512
|
get "lifecycleRules"() {
|
|
9491
9513
|
return array(LifecycleRuleSchema.describe("Defines a rule for managing the lifecycle of objects within a storage bucket.")).describe("List of rules for automatic object management (e.g., expiration).\nDefault: `[]` (empty list)").optional();
|
|
@@ -9575,7 +9597,7 @@ object({
|
|
|
9575
9597
|
get "links"() {
|
|
9576
9598
|
return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("List of resource references this worker depends on.");
|
|
9577
9599
|
},
|
|
9578
|
-
"memoryMb": optional(int().min(0).default(
|
|
9600
|
+
"memoryMb": optional(int().min(0).default(512).describe("Memory allocated to the worker in megabytes (MB).\nDefault: 512\n\nPlatform-specific constraints:\n- **AWS Lambda**: 128–10240 MB in 1 MB increments\n- **GCP Cloud Run**: 128–32768 MB\n- **Azure Container Apps**: fixed CPU/memory pairs — 512, 1024, 1536, 2048, 2560,\n 3072, 3584, 4096 MB. Values below 512 are automatically rounded up at deploy time.")),
|
|
9579
9601
|
"permissions": string().describe("Permission profile name that defines the permissions granted to this worker.\nThis references a profile defined in the stack's permission definitions."),
|
|
9580
9602
|
get "publicEndpoints"() {
|
|
9581
9603
|
return array(WorkerPublicEndpointSchema.describe("Public endpoint configuration for Worker resources.")).describe("Public endpoints exposed by this worker.").optional();
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
16
|
-
* import { command, kv
|
|
16
|
+
* import { command, kv } from "@alienplatform/sdk"
|
|
17
|
+
* import { z } from "zod"
|
|
17
18
|
*
|
|
18
|
-
* command("greet",
|
|
19
|
+
* command("greet", z.object({ name: z.string() }), async ({ name }) => {
|
|
19
20
|
* const store = kv("greetings")
|
|
20
21
|
* await store.set(name, `Hello, ${name}!`)
|
|
21
22
|
* return { ok: true }
|
|
@@ -25,9 +26,9 @@
|
|
|
25
26
|
* @packageDocumentation
|
|
26
27
|
*/
|
|
27
28
|
export { command, onStorageEvent, onCronEvent, onQueueMessage, waitUntil, } from "./worker-runtime/registry.js";
|
|
28
|
-
export type { StorageEvent, StorageEventType, CronEvent, QueueMessage, QueueMessageEvent, ScheduledEvent, WorkerCommandContext, } from "./worker-runtime/registry.js";
|
|
29
|
-
export { storage, kv, queue, vault } from "@alienplatform/bindings";
|
|
30
|
-
export type { Storage, Kv, Queue, Vault } from "@alienplatform/bindings";
|
|
29
|
+
export type { StorageEvent, StorageEventType, CronEvent, QueueMessage, QueueMessageEvent, ScheduledEvent, StandardSchema, StandardSchemaOutput, WorkerCommandContext, } from "./worker-runtime/registry.js";
|
|
30
|
+
export { storage, kv, queue, vault, container } from "@alienplatform/bindings";
|
|
31
|
+
export type { Storage, Kv, Queue, Vault, Container } from "@alienplatform/bindings";
|
|
31
32
|
export { BindingNotConfiguredError } from "@alienplatform/bindings";
|
|
32
33
|
export { AlienError } from "@alienplatform/core";
|
|
33
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,GACV,MAAM,8BAA8B,CAAA;AAErC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,8BAA8B,CAAA;AAMrC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAC9E,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAMnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as command, c as onCronEvent, l as onQueueMessage, p as waitUntil, t as AlienError, u as onStorageEvent } from "./dist.js";
|
|
2
|
-
import { BindingNotConfiguredError, kv, queue, storage, vault } from "@alienplatform/bindings";
|
|
3
|
-
export { AlienError, BindingNotConfiguredError, command, kv, onCronEvent, onQueueMessage, onStorageEvent, queue, storage, vault, waitUntil };
|
|
2
|
+
import { BindingNotConfiguredError, container, kv, queue, storage, vault } from "@alienplatform/bindings";
|
|
3
|
+
export { AlienError, BindingNotConfiguredError, command, container, kv, onCronEvent, onQueueMessage, onStorageEvent, queue, storage, vault, waitUntil };
|
|
@@ -58,6 +58,34 @@ export interface WorkerCommandContext {
|
|
|
58
58
|
/** Deadline for completion, when the sender set one. */
|
|
59
59
|
deadline?: Date;
|
|
60
60
|
}
|
|
61
|
+
/** The part of Standard Schema v1 used to validate command inputs. */
|
|
62
|
+
export interface StandardSchema<Input = unknown, Output = Input> {
|
|
63
|
+
readonly "~standard": {
|
|
64
|
+
readonly version: 1;
|
|
65
|
+
readonly vendor: string;
|
|
66
|
+
readonly validate: (value: unknown) => {
|
|
67
|
+
readonly value: Output;
|
|
68
|
+
readonly issues?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
readonly issues: ReadonlyArray<{
|
|
71
|
+
readonly message: string;
|
|
72
|
+
}>;
|
|
73
|
+
} | Promise<{
|
|
74
|
+
readonly value: Output;
|
|
75
|
+
readonly issues?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
readonly issues: ReadonlyArray<{
|
|
78
|
+
readonly message: string;
|
|
79
|
+
}>;
|
|
80
|
+
}>;
|
|
81
|
+
readonly types?: {
|
|
82
|
+
readonly input: Input;
|
|
83
|
+
readonly output: Output;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** Infer the validated output type of a Standard Schema. */
|
|
88
|
+
export type StandardSchemaOutput<Schema extends StandardSchema> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
61
89
|
/**
|
|
62
90
|
* Command definition.
|
|
63
91
|
*/
|
|
@@ -114,12 +142,13 @@ export interface TaskTracker {
|
|
|
114
142
|
* ```typescript
|
|
115
143
|
* import { command } from "@alienplatform/sdk"
|
|
116
144
|
*
|
|
117
|
-
* command("echo", async ({ message }
|
|
118
|
-
* return { message, attempt
|
|
145
|
+
* command("echo", schema, async ({ message }, { attempt }) => {
|
|
146
|
+
* return { message, attempt }
|
|
119
147
|
* })
|
|
120
148
|
* ```
|
|
121
149
|
*/
|
|
122
|
-
export declare function command<
|
|
150
|
+
export declare function command<TResult = unknown>(name: string, handler: (params: unknown, context: WorkerCommandContext) => TResult | Promise<TResult>): void;
|
|
151
|
+
export declare function command<Schema extends StandardSchema, TResult = unknown>(name: string, schema: Schema, handler: (params: StandardSchemaOutput<Schema>, context: WorkerCommandContext) => TResult | Promise<TResult>): void;
|
|
123
152
|
/** Get all registered commands. @internal */
|
|
124
153
|
export declare function getCommands(): Map<string, CommandDefinition>;
|
|
125
154
|
/** Execute a registered command by name. @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/worker-runtime/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAG5B,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,CAAA;AAE5E;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,oBAAoB;IACpB,YAAY,E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E,CAAC,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,CAE5F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alienplatform/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"nice-grpc": "^2.1.11",
|
|
54
54
|
"nice-grpc-common": "^2.0.2",
|
|
55
55
|
"zod": "4.3.2",
|
|
56
|
-
"@alienplatform/bindings": "^
|
|
57
|
-
"@alienplatform/core": "^
|
|
56
|
+
"@alienplatform/bindings": "^3.0.0",
|
|
57
|
+
"@alienplatform/core": "^3.0.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "tsdown && tsc --emitDeclarationOnly",
|