@orbit-app/functions 0.4.0 → 0.5.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.d.ts +3 -3
- package/dist/index.js +4 -3
- package/package.json +8 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ObjectsApi, type ObjectsClient } from "@orbit-app/web";
|
|
2
|
-
export { OrbitObjectError, type ObjectsApi, type ObjectsClient } from "@orbit-app/web";
|
|
1
|
+
import { type ObjectsApi, type ObjectsClient, type ObjectsOptions } from "@orbit-app/web";
|
|
2
|
+
export { OrbitObjectError, type ObjectsApi, type ObjectsClient, type ObjectsOptions, type RetryOptions } from "@orbit-app/web";
|
|
3
3
|
export type ActionTrigger = {
|
|
4
4
|
type: "action";
|
|
5
5
|
};
|
|
@@ -112,7 +112,7 @@ export type FunctionOrbit = {
|
|
|
112
112
|
objects: ObjectsApi;
|
|
113
113
|
defineObjects<Types extends Record<string, Record<string, unknown>>, Required extends {
|
|
114
114
|
[K in keyof Types]?: keyof Types[K];
|
|
115
|
-
} = {}>(): ObjectsClient<Types, Required>;
|
|
115
|
+
} = {}>(options?: ObjectsOptions): ObjectsClient<Types, Required>;
|
|
116
116
|
connections: {
|
|
117
117
|
get(provider: string): Promise<OrgConnection | null>;
|
|
118
118
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Orbit Functions: publisher code that runs in Orbit's sandbox, never on a member's Mac. A function
|
|
2
2
|
// acts as the store's org. It reaches only the Orbit API, with the token of its run.
|
|
3
|
-
import { OrbitObjectError, typedObjects, } from "@orbit-app/web";
|
|
3
|
+
import { OrbitObjectError, typedObjects, withRetry, } from "@orbit-app/web";
|
|
4
4
|
export { OrbitObjectError } from "@orbit-app/web";
|
|
5
5
|
const DELEGATE_CODES = [
|
|
6
6
|
"invalid",
|
|
@@ -156,7 +156,7 @@ function createOrbit(req) {
|
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
const enc = encodeURIComponent;
|
|
159
|
-
const
|
|
159
|
+
const once = {
|
|
160
160
|
create: (input) => call("POST", "/v1/objects", input),
|
|
161
161
|
get: (id) => call("GET", `/v1/objects/${enc(id)}`),
|
|
162
162
|
getByHandle: (type, handle) => call("GET", `/v1/objects/by-handle/${enc(type)}/${enc(handle)}`),
|
|
@@ -167,6 +167,7 @@ function createOrbit(req) {
|
|
|
167
167
|
await call("DELETE", `/v1/objects/${enc(id)}`);
|
|
168
168
|
},
|
|
169
169
|
};
|
|
170
|
+
const objects = withRetry(once);
|
|
170
171
|
function connection(c) {
|
|
171
172
|
return Object.freeze({
|
|
172
173
|
provider: c.provider,
|
|
@@ -196,7 +197,7 @@ function createOrbit(req) {
|
|
|
196
197
|
}
|
|
197
198
|
return {
|
|
198
199
|
objects,
|
|
199
|
-
defineObjects: () => typedObjects(objects),
|
|
200
|
+
defineObjects: (options) => typedObjects(options ? withRetry(once, options.retry) : objects),
|
|
200
201
|
connections: {
|
|
201
202
|
async get(provider) {
|
|
202
203
|
const list = (await call("GET", "/v1/connections?owner=org"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbit-app/functions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Write Orbit Functions: publisher code that runs in Orbit's sandbox as the store's org.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -12,14 +12,8 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsc -p tsconfig.build.json",
|
|
17
|
-
"typecheck": "tsc --noEmit",
|
|
18
|
-
"test": "tsc --noEmit && vitest run",
|
|
19
|
-
"prepack": "pnpm build"
|
|
20
|
-
},
|
|
21
15
|
"dependencies": {
|
|
22
|
-
"@orbit-app/web": "^0.1.
|
|
16
|
+
"@orbit-app/web": "^0.1.1"
|
|
23
17
|
},
|
|
24
18
|
"devDependencies": {
|
|
25
19
|
"typescript": "^7.0.2",
|
|
@@ -27,5 +21,10 @@
|
|
|
27
21
|
},
|
|
28
22
|
"publishConfig": {
|
|
29
23
|
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p tsconfig.build.json",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "tsc --noEmit && vitest run"
|
|
30
29
|
}
|
|
31
|
-
}
|
|
30
|
+
}
|