@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/api.md CHANGED
@@ -455,6 +455,14 @@ All workspace-scoped resources also expose `withOptions(options)`.
455
455
  - `getCatalog`
456
456
  - `query`
457
457
  - `sync`
458
+ - `deploy`
459
+ - `listRegistered`
460
+ - `listVersions`
461
+ - `getVersion`
462
+ - `invoke`
463
+ - `testV2`
464
+ - `promote`
465
+ - `rollback`
458
466
 
459
467
  ### `observers`
460
468
 
package/dist/index.cjs CHANGED
@@ -4173,6 +4173,117 @@ var FunctionsResource = class extends WorkspaceScopedResource {
4173
4173
  })
4174
4174
  );
4175
4175
  }
4176
+ // ── V109 SQL-first surface ────────────────────────────────────────
4177
+ // The methods below operate against ``platform.functions`` (the
4178
+ // versioned, alias-pinned, typed-parameter table introduced in
4179
+ // platform migration V109). The legacy methods above continue to
4180
+ // wrap the JSONB-backed ``workspace.settings["functions"]`` shape;
4181
+ // both surfaces co-exist so callers can migrate at their own pace.
4182
+ /**
4183
+ * Validate + register a new platform function version. Atomic:
4184
+ * validation + INSERT + ``latest`` alias rebind happen in one
4185
+ * transaction. Concurrent deploys race-fail on the UNIQUE
4186
+ * constraint and return 409.
4187
+ */
4188
+ async deploy(body) {
4189
+ return extractData(
4190
+ await this.client.POST("/v1/{workspace_id}/functions/deploy", {
4191
+ params: { path: { workspace_id: this.workspaceId } },
4192
+ body
4193
+ })
4194
+ );
4195
+ }
4196
+ /**
4197
+ * List the ``latest`` version of every V109-registered platform
4198
+ * function in the workspace. Returns one row per function (the
4199
+ * alias-pinned latest version).
4200
+ *
4201
+ * Distinct from :meth:`list` which reads the legacy
4202
+ * ``workspace.settings["functions"]`` JSONB store; both surfaces
4203
+ * co-exist while callers migrate. Prefer this for V109 functions.
4204
+ */
4205
+ async listRegistered() {
4206
+ return extractData(
4207
+ await this.client.GET("/v1/{workspace_id}/functions/registered", {
4208
+ params: { path: { workspace_id: this.workspaceId } }
4209
+ })
4210
+ );
4211
+ }
4212
+ /**
4213
+ * List all immutable versions of a registered function, newest first.
4214
+ */
4215
+ async listVersions(functionName) {
4216
+ return extractData(
4217
+ await this.client.GET("/v1/{workspace_id}/functions/{function_name}/versions", {
4218
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } }
4219
+ })
4220
+ );
4221
+ }
4222
+ /**
4223
+ * Resolve ``(function_name, alias)`` to a specific version row.
4224
+ * Default alias: ``latest``.
4225
+ */
4226
+ async getVersion(functionName, alias = "latest") {
4227
+ return extractData(
4228
+ await this.client.GET("/v1/{workspace_id}/functions/{function_name}/version", {
4229
+ params: {
4230
+ path: { workspace_id: this.workspaceId, function_name: functionName },
4231
+ query: { alias }
4232
+ }
4233
+ })
4234
+ );
4235
+ }
4236
+ /**
4237
+ * Execute a registered function. Bound parameters validated against
4238
+ * the version's stored schema; ``ws_id`` auto-injected from request
4239
+ * context. Returns the executor's shaped response (rows for
4240
+ * ``returns=table``, scalar for ``returns=scalar``).
4241
+ */
4242
+ async invoke(functionName, body) {
4243
+ return extractData(
4244
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/invoke", {
4245
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4246
+ body
4247
+ })
4248
+ );
4249
+ }
4250
+ /**
4251
+ * Test invoke — same as ``invoke`` plus persists ``last_test_*``
4252
+ * telemetry on the version row so the DC tool list can show
4253
+ * health without re-running.
4254
+ */
4255
+ async testV2(functionName, body) {
4256
+ return extractData(
4257
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/v2/test", {
4258
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4259
+ body
4260
+ })
4261
+ );
4262
+ }
4263
+ /**
4264
+ * Rebind an alias (``latest`` / ``staging`` / ``production``) to a
4265
+ * specific version. Verifies the version exists before rebinding.
4266
+ */
4267
+ async promote(functionName, body) {
4268
+ return extractData(
4269
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/promote", {
4270
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4271
+ body
4272
+ })
4273
+ );
4274
+ }
4275
+ /**
4276
+ * Rebind ``latest`` and ``production`` to a prior version. The
4277
+ * "oops the new deploy was bad" path. ``staging`` stays untouched.
4278
+ */
4279
+ async rollback(functionName, body) {
4280
+ return extractData(
4281
+ await this.client.POST("/v1/{workspace_id}/functions/{function_name}/rollback", {
4282
+ params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
4283
+ body
4284
+ })
4285
+ );
4286
+ }
4176
4287
  };
4177
4288
 
4178
4289
  // src/core/reconnecting-websocket.ts