@amigo-ai/platform-sdk 0.33.0 → 0.37.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 +7 -0
- package/dist/index.cjs +95 -0
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +95 -0
- package/dist/index.mjs.map +2 -2
- package/dist/resources/functions.js +81 -0
- package/dist/resources/functions.js.map +1 -1
- package/dist/types/generated/api.d.ts +1285 -15
- package/dist/types/generated/api.d.ts.map +1 -1
- package/dist/types/resources/functions.d.ts +137 -0
- package/dist/types/resources/functions.d.ts.map +1 -1
- package/dist/types/resources/intake.d.ts.map +1 -1
- package/dist/types/resources/metrics.d.ts.map +1 -1
- package/dist/types/resources/operators.d.ts.map +1 -1
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/dist/types/resources/surfaces.d.ts.map +1 -1
- package/package.json +1 -1
package/api.md
CHANGED
|
@@ -455,6 +455,13 @@ All workspace-scoped resources also expose `withOptions(options)`.
|
|
|
455
455
|
- `getCatalog`
|
|
456
456
|
- `query`
|
|
457
457
|
- `sync`
|
|
458
|
+
- `deploy`
|
|
459
|
+
- `listVersions`
|
|
460
|
+
- `getVersion`
|
|
461
|
+
- `invoke`
|
|
462
|
+
- `testV2`
|
|
463
|
+
- `promote`
|
|
464
|
+
- `rollback`
|
|
458
465
|
|
|
459
466
|
### `observers`
|
|
460
467
|
|
package/dist/index.cjs
CHANGED
|
@@ -4173,6 +4173,101 @@ 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 all immutable versions of a registered function, newest first.
|
|
4198
|
+
*/
|
|
4199
|
+
async listVersions(functionName) {
|
|
4200
|
+
return extractData(
|
|
4201
|
+
await this.client.GET("/v1/{workspace_id}/functions/{function_name}/versions", {
|
|
4202
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } }
|
|
4203
|
+
})
|
|
4204
|
+
);
|
|
4205
|
+
}
|
|
4206
|
+
/**
|
|
4207
|
+
* Resolve ``(function_name, alias)`` to a specific version row.
|
|
4208
|
+
* Default alias: ``latest``.
|
|
4209
|
+
*/
|
|
4210
|
+
async getVersion(functionName, alias = "latest") {
|
|
4211
|
+
return extractData(
|
|
4212
|
+
await this.client.GET("/v1/{workspace_id}/functions/{function_name}/version", {
|
|
4213
|
+
params: {
|
|
4214
|
+
path: { workspace_id: this.workspaceId, function_name: functionName },
|
|
4215
|
+
query: { alias }
|
|
4216
|
+
}
|
|
4217
|
+
})
|
|
4218
|
+
);
|
|
4219
|
+
}
|
|
4220
|
+
/**
|
|
4221
|
+
* Execute a registered function. Bound parameters validated against
|
|
4222
|
+
* the version's stored schema; ``ws_id`` auto-injected from request
|
|
4223
|
+
* context. Returns the executor's shaped response (rows for
|
|
4224
|
+
* ``returns=table``, scalar for ``returns=scalar``).
|
|
4225
|
+
*/
|
|
4226
|
+
async invoke(functionName, body) {
|
|
4227
|
+
return extractData(
|
|
4228
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/invoke", {
|
|
4229
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4230
|
+
body
|
|
4231
|
+
})
|
|
4232
|
+
);
|
|
4233
|
+
}
|
|
4234
|
+
/**
|
|
4235
|
+
* Test invoke — same as ``invoke`` plus persists ``last_test_*``
|
|
4236
|
+
* telemetry on the version row so the DC tool list can show
|
|
4237
|
+
* health without re-running.
|
|
4238
|
+
*/
|
|
4239
|
+
async testV2(functionName, body) {
|
|
4240
|
+
return extractData(
|
|
4241
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/v2/test", {
|
|
4242
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4243
|
+
body
|
|
4244
|
+
})
|
|
4245
|
+
);
|
|
4246
|
+
}
|
|
4247
|
+
/**
|
|
4248
|
+
* Rebind an alias (``latest`` / ``staging`` / ``production``) to a
|
|
4249
|
+
* specific version. Verifies the version exists before rebinding.
|
|
4250
|
+
*/
|
|
4251
|
+
async promote(functionName, body) {
|
|
4252
|
+
return extractData(
|
|
4253
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/promote", {
|
|
4254
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4255
|
+
body
|
|
4256
|
+
})
|
|
4257
|
+
);
|
|
4258
|
+
}
|
|
4259
|
+
/**
|
|
4260
|
+
* Rebind ``latest`` and ``production`` to a prior version. The
|
|
4261
|
+
* "oops the new deploy was bad" path. ``staging`` stays untouched.
|
|
4262
|
+
*/
|
|
4263
|
+
async rollback(functionName, body) {
|
|
4264
|
+
return extractData(
|
|
4265
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/rollback", {
|
|
4266
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4267
|
+
body
|
|
4268
|
+
})
|
|
4269
|
+
);
|
|
4270
|
+
}
|
|
4176
4271
|
};
|
|
4177
4272
|
|
|
4178
4273
|
// src/core/reconnecting-websocket.ts
|