@amigo-ai/platform-sdk 0.34.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 +1195 -184
- 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/dist/index.mjs
CHANGED
|
@@ -4065,6 +4065,101 @@ 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 all immutable versions of a registered function, newest first.
|
|
4090
|
+
*/
|
|
4091
|
+
async listVersions(functionName) {
|
|
4092
|
+
return extractData(
|
|
4093
|
+
await this.client.GET("/v1/{workspace_id}/functions/{function_name}/versions", {
|
|
4094
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } }
|
|
4095
|
+
})
|
|
4096
|
+
);
|
|
4097
|
+
}
|
|
4098
|
+
/**
|
|
4099
|
+
* Resolve ``(function_name, alias)`` to a specific version row.
|
|
4100
|
+
* Default alias: ``latest``.
|
|
4101
|
+
*/
|
|
4102
|
+
async getVersion(functionName, alias = "latest") {
|
|
4103
|
+
return extractData(
|
|
4104
|
+
await this.client.GET("/v1/{workspace_id}/functions/{function_name}/version", {
|
|
4105
|
+
params: {
|
|
4106
|
+
path: { workspace_id: this.workspaceId, function_name: functionName },
|
|
4107
|
+
query: { alias }
|
|
4108
|
+
}
|
|
4109
|
+
})
|
|
4110
|
+
);
|
|
4111
|
+
}
|
|
4112
|
+
/**
|
|
4113
|
+
* Execute a registered function. Bound parameters validated against
|
|
4114
|
+
* the version's stored schema; ``ws_id`` auto-injected from request
|
|
4115
|
+
* context. Returns the executor's shaped response (rows for
|
|
4116
|
+
* ``returns=table``, scalar for ``returns=scalar``).
|
|
4117
|
+
*/
|
|
4118
|
+
async invoke(functionName, body) {
|
|
4119
|
+
return extractData(
|
|
4120
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/invoke", {
|
|
4121
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4122
|
+
body
|
|
4123
|
+
})
|
|
4124
|
+
);
|
|
4125
|
+
}
|
|
4126
|
+
/**
|
|
4127
|
+
* Test invoke — same as ``invoke`` plus persists ``last_test_*``
|
|
4128
|
+
* telemetry on the version row so the DC tool list can show
|
|
4129
|
+
* health without re-running.
|
|
4130
|
+
*/
|
|
4131
|
+
async testV2(functionName, body) {
|
|
4132
|
+
return extractData(
|
|
4133
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/v2/test", {
|
|
4134
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4135
|
+
body
|
|
4136
|
+
})
|
|
4137
|
+
);
|
|
4138
|
+
}
|
|
4139
|
+
/**
|
|
4140
|
+
* Rebind an alias (``latest`` / ``staging`` / ``production``) to a
|
|
4141
|
+
* specific version. Verifies the version exists before rebinding.
|
|
4142
|
+
*/
|
|
4143
|
+
async promote(functionName, body) {
|
|
4144
|
+
return extractData(
|
|
4145
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/promote", {
|
|
4146
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4147
|
+
body
|
|
4148
|
+
})
|
|
4149
|
+
);
|
|
4150
|
+
}
|
|
4151
|
+
/**
|
|
4152
|
+
* Rebind ``latest`` and ``production`` to a prior version. The
|
|
4153
|
+
* "oops the new deploy was bad" path. ``staging`` stays untouched.
|
|
4154
|
+
*/
|
|
4155
|
+
async rollback(functionName, body) {
|
|
4156
|
+
return extractData(
|
|
4157
|
+
await this.client.POST("/v1/{workspace_id}/functions/{function_name}/rollback", {
|
|
4158
|
+
params: { path: { workspace_id: this.workspaceId, function_name: functionName } },
|
|
4159
|
+
body
|
|
4160
|
+
})
|
|
4161
|
+
);
|
|
4162
|
+
}
|
|
4068
4163
|
};
|
|
4069
4164
|
|
|
4070
4165
|
// src/core/reconnecting-websocket.ts
|