@proveanything/smartlinks 2.0.19 → 2.0.20
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/api/functions.d.ts +27 -0
- package/dist/api/functions.js +38 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/docs/API_SUMMARY.md +35 -1
- package/dist/openapi.yaml +45 -0
- package/docs/API_SUMMARY.md +35 -1
- package/openapi.yaml +45 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** A server function's returned value — shape is app-defined, so untyped by default. */
|
|
2
|
+
export type FunctionCallResult = any;
|
|
3
|
+
export interface FunctionListEntry {
|
|
4
|
+
name: string;
|
|
5
|
+
visibility?: string;
|
|
6
|
+
trigger?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FunctionListResponse {
|
|
9
|
+
functions: FunctionListEntry[];
|
|
10
|
+
}
|
|
11
|
+
export declare namespace functions {
|
|
12
|
+
/**
|
|
13
|
+
* Call a PUBLIC app server function inline.
|
|
14
|
+
* `POST /public/collection/:collectionId/functions/:name` — surface `'public'`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { value } = await SL.functions.call<{ value: number }>(collectionId, 'increment')
|
|
18
|
+
*/
|
|
19
|
+
function call<T = FunctionCallResult>(collectionId: string, name: string, body?: Record<string, any>): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Call an ADMIN app server function (surface `'admin'`; requires an admin session).
|
|
22
|
+
* `POST /admin/collection/:collectionId/functions/:name`.
|
|
23
|
+
*/
|
|
24
|
+
function callAdmin<T = FunctionCallResult>(collectionId: string, name: string, body?: Record<string, any>): Promise<T>;
|
|
25
|
+
/** List the public functions available for a collection (discovery). `GET /public/collection/:c/functions`. */
|
|
26
|
+
function list(collectionId: string): Promise<FunctionListResponse>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Client-side invocation of app SERVER FUNCTIONS.
|
|
2
|
+
//
|
|
3
|
+
// The function itself is authored server-side (one contract: `async (ctx, event) => result`,
|
|
4
|
+
// see docs/server-functions.md). THIS is how a page/UI actually calls one — the missing
|
|
5
|
+
// client half. The PUBLIC route runs a function inline on the caller's own authority (owner if
|
|
6
|
+
// signed in via authKit, else public); the ADMIN route runs on the admin surface (needs an admin
|
|
7
|
+
// session). The returned value is the function's own result (`event.body` is what you pass here).
|
|
8
|
+
import { post, request } from "../http.js";
|
|
9
|
+
export var functions;
|
|
10
|
+
(function (functions) {
|
|
11
|
+
/**
|
|
12
|
+
* Call a PUBLIC app server function inline.
|
|
13
|
+
* `POST /public/collection/:collectionId/functions/:name` — surface `'public'`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const { value } = await SL.functions.call<{ value: number }>(collectionId, 'increment')
|
|
17
|
+
*/
|
|
18
|
+
async function call(collectionId, name, body = {}) {
|
|
19
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/functions/${encodeURIComponent(name)}`;
|
|
20
|
+
return post(path, body);
|
|
21
|
+
}
|
|
22
|
+
functions.call = call;
|
|
23
|
+
/**
|
|
24
|
+
* Call an ADMIN app server function (surface `'admin'`; requires an admin session).
|
|
25
|
+
* `POST /admin/collection/:collectionId/functions/:name`.
|
|
26
|
+
*/
|
|
27
|
+
async function callAdmin(collectionId, name, body = {}) {
|
|
28
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/functions/${encodeURIComponent(name)}`;
|
|
29
|
+
return post(path, body);
|
|
30
|
+
}
|
|
31
|
+
functions.callAdmin = callAdmin;
|
|
32
|
+
/** List the public functions available for a collection (discovery). `GET /public/collection/:c/functions`. */
|
|
33
|
+
async function list(collectionId) {
|
|
34
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/functions`;
|
|
35
|
+
return request(path);
|
|
36
|
+
}
|
|
37
|
+
functions.list = list;
|
|
38
|
+
})(functions || (functions = {}));
|
package/dist/api/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export { qr } from "./qr.js";
|
|
|
28
28
|
export { template } from "./template.js";
|
|
29
29
|
export { interactions } from "./interactions.js";
|
|
30
30
|
export { analytics } from "./analytics.js";
|
|
31
|
+
export { functions } from "./functions.js";
|
|
31
32
|
export { location } from "./location.js";
|
|
32
33
|
export * as realtime from "./realtime.js";
|
|
33
34
|
export { tags } from "./tags.js";
|
package/dist/api/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { qr } from "./qr.js";
|
|
|
30
30
|
export { template } from "./template.js";
|
|
31
31
|
export { interactions } from "./interactions.js";
|
|
32
32
|
export { analytics } from "./analytics.js";
|
|
33
|
+
export { functions } from "./functions.js";
|
|
33
34
|
export { location } from "./location.js";
|
|
34
35
|
import * as realtime_1 from "./realtime.js";
|
|
35
36
|
export { realtime_1 as realtime };
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.20 | Generated: 2026-09-25T11:48:23.950Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -135,6 +135,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
135
135
|
- **config** - Functions for config operations
|
|
136
136
|
- **containers** - Functions for containers operations
|
|
137
137
|
- **facets** - Functions for facets operations
|
|
138
|
+
- **functions** - Functions for functions operations
|
|
138
139
|
- **http** - Functions for http operations
|
|
139
140
|
- **integrations** - Functions for integrations operations
|
|
140
141
|
- **jobs** - Functions for jobs operations
|
|
@@ -8943,6 +8944,24 @@ type VerifyTokenResponse = {
|
|
|
8943
8944
|
}
|
|
8944
8945
|
```
|
|
8945
8946
|
|
|
8947
|
+
### functions (api)
|
|
8948
|
+
|
|
8949
|
+
**FunctionListEntry** (interface)
|
|
8950
|
+
```typescript
|
|
8951
|
+
interface FunctionListEntry {
|
|
8952
|
+
name: string; visibility?: string; trigger?: string
|
|
8953
|
+
}
|
|
8954
|
+
```
|
|
8955
|
+
|
|
8956
|
+
**FunctionListResponse** (interface)
|
|
8957
|
+
```typescript
|
|
8958
|
+
interface FunctionListResponse {
|
|
8959
|
+
functions: FunctionListEntry[]
|
|
8960
|
+
}
|
|
8961
|
+
```
|
|
8962
|
+
|
|
8963
|
+
**FunctionCallResult** = `any`
|
|
8964
|
+
|
|
8946
8965
|
### sequence (api)
|
|
8947
8966
|
|
|
8948
8967
|
**AllocateSequenceInput** (interface)
|
|
@@ -10435,6 +10454,21 @@ Update a form for a collection (admin only).
|
|
|
10435
10454
|
**remove**(collectionId: string, formId: string) → `Promise<void>`
|
|
10436
10455
|
Delete a form for a collection (admin only).
|
|
10437
10456
|
|
|
10457
|
+
### functions
|
|
10458
|
+
|
|
10459
|
+
**call**(collectionId: string,
|
|
10460
|
+
name: string,
|
|
10461
|
+
body: Record<string, any> = {}) → `Promise<T>`
|
|
10462
|
+
Call a PUBLIC app server function inline. `POST /public/collection/:collectionId/functions/:name` — surface `'public'`. const { value } = await SL.functions.call<{ value: number }>(collectionId, 'increment')
|
|
10463
|
+
|
|
10464
|
+
**callAdmin**(collectionId: string,
|
|
10465
|
+
name: string,
|
|
10466
|
+
body: Record<string, any> = {}) → `Promise<T>`
|
|
10467
|
+
Call an ADMIN app server function (surface `'admin'`; requires an admin session). `POST /admin/collection/:collectionId/functions/:name`.
|
|
10468
|
+
|
|
10469
|
+
**list**(collectionId: string) → `Promise<FunctionListResponse>`
|
|
10470
|
+
List the public functions available for a collection (discovery). `GET /public/collection/:c/functions`.
|
|
10471
|
+
|
|
10438
10472
|
### http
|
|
10439
10473
|
|
|
10440
10474
|
**get**(path: string) → `Promise<T>`
|
package/dist/openapi.yaml
CHANGED
|
@@ -72,6 +72,8 @@ tags:
|
|
|
72
72
|
description: Product facet querying and aggregation.
|
|
73
73
|
- name: form
|
|
74
74
|
description: Form definitions and submissions.
|
|
75
|
+
- name: functions
|
|
76
|
+
description: functions API
|
|
75
77
|
- name: integrations
|
|
76
78
|
description: Third-party integration flows and imports.
|
|
77
79
|
- name: interactions
|
|
@@ -12150,6 +12152,32 @@ paths:
|
|
|
12150
12152
|
description: Unauthorized
|
|
12151
12153
|
404:
|
|
12152
12154
|
description: Not found
|
|
12155
|
+
/public/collection/{collectionId}/functions:
|
|
12156
|
+
get:
|
|
12157
|
+
tags:
|
|
12158
|
+
- functions
|
|
12159
|
+
summary: List the public functions available for a collection (discovery).
|
|
12160
|
+
operationId: functions_list
|
|
12161
|
+
security: []
|
|
12162
|
+
parameters:
|
|
12163
|
+
- name: collectionId
|
|
12164
|
+
in: path
|
|
12165
|
+
required: true
|
|
12166
|
+
schema:
|
|
12167
|
+
type: string
|
|
12168
|
+
responses:
|
|
12169
|
+
200:
|
|
12170
|
+
description: Success
|
|
12171
|
+
content:
|
|
12172
|
+
application/json:
|
|
12173
|
+
schema:
|
|
12174
|
+
$ref: "#/components/schemas/FunctionListResponse"
|
|
12175
|
+
400:
|
|
12176
|
+
description: Bad request
|
|
12177
|
+
401:
|
|
12178
|
+
description: Unauthorized
|
|
12179
|
+
404:
|
|
12180
|
+
description: Not found
|
|
12153
12181
|
/public/collection/{collectionId}/interactions:
|
|
12154
12182
|
get:
|
|
12155
12183
|
tags:
|
|
@@ -29269,6 +29297,23 @@ components:
|
|
|
29269
29297
|
additionalProperties: true
|
|
29270
29298
|
required:
|
|
29271
29299
|
- valid
|
|
29300
|
+
FunctionListEntry:
|
|
29301
|
+
type: object
|
|
29302
|
+
properties:
|
|
29303
|
+
name:
|
|
29304
|
+
type: object
|
|
29305
|
+
additionalProperties: true
|
|
29306
|
+
required:
|
|
29307
|
+
- name
|
|
29308
|
+
FunctionListResponse:
|
|
29309
|
+
type: object
|
|
29310
|
+
properties:
|
|
29311
|
+
functions:
|
|
29312
|
+
type: array
|
|
29313
|
+
items:
|
|
29314
|
+
$ref: "#/components/schemas/FunctionListEntry"
|
|
29315
|
+
required:
|
|
29316
|
+
- functions
|
|
29272
29317
|
AllocateSequenceInput:
|
|
29273
29318
|
type: object
|
|
29274
29319
|
properties:
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.20 | Generated: 2026-09-25T11:48:23.950Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -135,6 +135,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
135
135
|
- **config** - Functions for config operations
|
|
136
136
|
- **containers** - Functions for containers operations
|
|
137
137
|
- **facets** - Functions for facets operations
|
|
138
|
+
- **functions** - Functions for functions operations
|
|
138
139
|
- **http** - Functions for http operations
|
|
139
140
|
- **integrations** - Functions for integrations operations
|
|
140
141
|
- **jobs** - Functions for jobs operations
|
|
@@ -8943,6 +8944,24 @@ type VerifyTokenResponse = {
|
|
|
8943
8944
|
}
|
|
8944
8945
|
```
|
|
8945
8946
|
|
|
8947
|
+
### functions (api)
|
|
8948
|
+
|
|
8949
|
+
**FunctionListEntry** (interface)
|
|
8950
|
+
```typescript
|
|
8951
|
+
interface FunctionListEntry {
|
|
8952
|
+
name: string; visibility?: string; trigger?: string
|
|
8953
|
+
}
|
|
8954
|
+
```
|
|
8955
|
+
|
|
8956
|
+
**FunctionListResponse** (interface)
|
|
8957
|
+
```typescript
|
|
8958
|
+
interface FunctionListResponse {
|
|
8959
|
+
functions: FunctionListEntry[]
|
|
8960
|
+
}
|
|
8961
|
+
```
|
|
8962
|
+
|
|
8963
|
+
**FunctionCallResult** = `any`
|
|
8964
|
+
|
|
8946
8965
|
### sequence (api)
|
|
8947
8966
|
|
|
8948
8967
|
**AllocateSequenceInput** (interface)
|
|
@@ -10435,6 +10454,21 @@ Update a form for a collection (admin only).
|
|
|
10435
10454
|
**remove**(collectionId: string, formId: string) → `Promise<void>`
|
|
10436
10455
|
Delete a form for a collection (admin only).
|
|
10437
10456
|
|
|
10457
|
+
### functions
|
|
10458
|
+
|
|
10459
|
+
**call**(collectionId: string,
|
|
10460
|
+
name: string,
|
|
10461
|
+
body: Record<string, any> = {}) → `Promise<T>`
|
|
10462
|
+
Call a PUBLIC app server function inline. `POST /public/collection/:collectionId/functions/:name` — surface `'public'`. const { value } = await SL.functions.call<{ value: number }>(collectionId, 'increment')
|
|
10463
|
+
|
|
10464
|
+
**callAdmin**(collectionId: string,
|
|
10465
|
+
name: string,
|
|
10466
|
+
body: Record<string, any> = {}) → `Promise<T>`
|
|
10467
|
+
Call an ADMIN app server function (surface `'admin'`; requires an admin session). `POST /admin/collection/:collectionId/functions/:name`.
|
|
10468
|
+
|
|
10469
|
+
**list**(collectionId: string) → `Promise<FunctionListResponse>`
|
|
10470
|
+
List the public functions available for a collection (discovery). `GET /public/collection/:c/functions`.
|
|
10471
|
+
|
|
10438
10472
|
### http
|
|
10439
10473
|
|
|
10440
10474
|
**get**(path: string) → `Promise<T>`
|
package/openapi.yaml
CHANGED
|
@@ -72,6 +72,8 @@ tags:
|
|
|
72
72
|
description: Product facet querying and aggregation.
|
|
73
73
|
- name: form
|
|
74
74
|
description: Form definitions and submissions.
|
|
75
|
+
- name: functions
|
|
76
|
+
description: functions API
|
|
75
77
|
- name: integrations
|
|
76
78
|
description: Third-party integration flows and imports.
|
|
77
79
|
- name: interactions
|
|
@@ -12150,6 +12152,32 @@ paths:
|
|
|
12150
12152
|
description: Unauthorized
|
|
12151
12153
|
404:
|
|
12152
12154
|
description: Not found
|
|
12155
|
+
/public/collection/{collectionId}/functions:
|
|
12156
|
+
get:
|
|
12157
|
+
tags:
|
|
12158
|
+
- functions
|
|
12159
|
+
summary: List the public functions available for a collection (discovery).
|
|
12160
|
+
operationId: functions_list
|
|
12161
|
+
security: []
|
|
12162
|
+
parameters:
|
|
12163
|
+
- name: collectionId
|
|
12164
|
+
in: path
|
|
12165
|
+
required: true
|
|
12166
|
+
schema:
|
|
12167
|
+
type: string
|
|
12168
|
+
responses:
|
|
12169
|
+
200:
|
|
12170
|
+
description: Success
|
|
12171
|
+
content:
|
|
12172
|
+
application/json:
|
|
12173
|
+
schema:
|
|
12174
|
+
$ref: "#/components/schemas/FunctionListResponse"
|
|
12175
|
+
400:
|
|
12176
|
+
description: Bad request
|
|
12177
|
+
401:
|
|
12178
|
+
description: Unauthorized
|
|
12179
|
+
404:
|
|
12180
|
+
description: Not found
|
|
12153
12181
|
/public/collection/{collectionId}/interactions:
|
|
12154
12182
|
get:
|
|
12155
12183
|
tags:
|
|
@@ -29269,6 +29297,23 @@ components:
|
|
|
29269
29297
|
additionalProperties: true
|
|
29270
29298
|
required:
|
|
29271
29299
|
- valid
|
|
29300
|
+
FunctionListEntry:
|
|
29301
|
+
type: object
|
|
29302
|
+
properties:
|
|
29303
|
+
name:
|
|
29304
|
+
type: object
|
|
29305
|
+
additionalProperties: true
|
|
29306
|
+
required:
|
|
29307
|
+
- name
|
|
29308
|
+
FunctionListResponse:
|
|
29309
|
+
type: object
|
|
29310
|
+
properties:
|
|
29311
|
+
functions:
|
|
29312
|
+
type: array
|
|
29313
|
+
items:
|
|
29314
|
+
$ref: "#/components/schemas/FunctionListEntry"
|
|
29315
|
+
required:
|
|
29316
|
+
- functions
|
|
29272
29317
|
AllocateSequenceInput:
|
|
29273
29318
|
type: object
|
|
29274
29319
|
properties:
|