@amigo-ai/platform-sdk 0.34.0 → 0.39.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/index.mjs CHANGED
@@ -4065,6 +4065,117 @@ var FunctionsResource = class extends WorkspaceScopedResource {
4065
4065
  })
4066
4066
  );
4067
4067
  }
4068
+ // ── V109 SQL-first surface ────────────────────────────────────────
4069
+ // The methods below operate against ``platform.functions`` (the
4070
+ // versioned, alias-pinned, typed-parameter table introduced in
4071
+ // platform migration V109). The legacy methods above continue to
4072
+ // wrap the JSONB-backed ``workspace.settings["functions"]`` shape;
4073
+ // both surfaces co-exist so callers can migrate at their own pace.
4074
+ /**
4075
+ * Validate + register a new platform function version. Atomic:
4076
+ * validation + INSERT + ``latest`` alias rebind happen in one
4077
+ * transaction. Concurrent deploys race-fail on the UNIQUE
4078
+ * constraint and return 409.
4079
+ */
4080
+ async deploy(body) {
4081
+ return extractData(
4082
+ await this.client.POST("/v1/{workspace_id}/functions/deploy", {
4083
+ params: { path: { workspace_id: this.workspaceId } },
4084
+ body
4085
+ })
4086
+ );
4087
+ }
4088
+ /**
4089
+ * List the ``latest`` version of every V109-registered platform
4090
+ * function in the workspace. Returns one row per function (the
4091
+ * alias-pinned latest version).
4092
+ *
4093
+ * Distinct from :meth:`list` which reads the legacy
4094
+ * ``workspace.settings["functions"]`` JSONB store; both surfaces
4095
+ * co-exist while callers migrate. Prefer this for V109 functions.
4096
+ */
4097
+ async listRegistered() {
4098
+ return extractData(
4099
+ await this.client.GET("/v1/{workspace_id}/functions/registered", {
4100
+ params: { path: { workspace_id: this.workspaceId } }
4101
+ })
4102
+ );
4103
+ }
4104
+ /**
4105
+ * List all immutable versions of a registered function, newest first.
4106
+ */
4107
+ async listVersions(functionName) {
4108
+ return extractData(
4109
+ await this.client.GET("/v1/{workspace_id}/functions/{function_name}/versions", {
4110
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } }
4111
+ })
4112
+ );
4113
+ }
4114
+ /**
4115
+ * Resolve ``(function_name, alias)`` to a specific version row.
4116
+ * Default alias: ``latest``.
4117
+ */
4118
+ async getVersion(functionName, alias = "latest") {
4119
+ return extractData(
4120
+ await this.client.GET("/v1/{workspace_id}/functions/{function_name}/version", {
4121
+ params: {
4122
+ path: { workspace_id: this.workspaceId, function_name: functionName },
4123
+ query: { alias }
4124
+ }
4125
+ })
4126
+ );
4127
+ }
4128
+ /**
4129
+ * Execute a registered function. Bound parameters validated against
4130
+ * the version's stored schema; ``ws_id`` auto-injected from request
4131
+ * context. Returns the executor's shaped response (rows for
4132
+ * ``returns=table``, scalar for ``returns=scalar``).
4133
+ */
4134
+ async invoke(functionName, body) {
4135
+ return extractData(
4136
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/invoke", {
4137
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4138
+ body
4139
+ })
4140
+ );
4141
+ }
4142
+ /**
4143
+ * Test invoke — same as ``invoke`` plus persists ``last_test_*``
4144
+ * telemetry on the version row so the DC tool list can show
4145
+ * health without re-running.
4146
+ */
4147
+ async testV2(functionName, body) {
4148
+ return extractData(
4149
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/v2/test", {
4150
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4151
+ body
4152
+ })
4153
+ );
4154
+ }
4155
+ /**
4156
+ * Rebind an alias (``latest`` / ``staging`` / ``production``) to a
4157
+ * specific version. Verifies the version exists before rebinding.
4158
+ */
4159
+ async promote(functionName, body) {
4160
+ return extractData(
4161
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/promote", {
4162
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4163
+ body
4164
+ })
4165
+ );
4166
+ }
4167
+ /**
4168
+ * Rebind ``latest`` and ``production`` to a prior version. The
4169
+ * "oops the new deploy was bad" path. ``staging`` stays untouched.
4170
+ */
4171
+ async rollback(functionName, body) {
4172
+ return extractData(
4173
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/rollback", {
4174
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4175
+ body
4176
+ })
4177
+ );
4178
+ }
4068
4179
  };
4069
4180
 
4070
4181
  // src/core/reconnecting-websocket.ts