shapeshift-sdk 0.1.0 → 0.1.1

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/react.js CHANGED
@@ -146,14 +146,14 @@ export function useAddonList({ basePath = DEFAULT_BASE } = {}) {
146
146
  // This company's activity log, newest first. `more()` loads older entries.
147
147
  export function useActivity({ basePath = DEFAULT_BASE, limit = 50 } = {}) {
148
148
  const [entries, setEntries] = useState([]);
149
- const [done, setDone] = useState(false);
149
+ const [next, setNext] = useState(null);
150
150
  const [error, setError] = useState("");
151
151
  const load = useCallback(async (before) => {
152
152
  try {
153
153
  const q = new URLSearchParams({ limit: String(limit), ...(before ? { before } : {}) });
154
154
  const res = await req(basePath, `/activity?${q}`);
155
155
  setEntries((old) => (before ? [...old, ...res.entries] : res.entries));
156
- setDone(res.entries.length < limit);
156
+ setNext(res.next);
157
157
  setError("");
158
158
  }
159
159
  catch (e) {
@@ -167,8 +167,8 @@ export function useActivity({ basePath = DEFAULT_BASE, limit = 50 } = {}) {
167
167
  return {
168
168
  entries,
169
169
  error,
170
- done,
170
+ done: next === null,
171
171
  refresh: () => load(),
172
- more: () => (entries.length ? load(entries[entries.length - 1].at) : load()),
172
+ more: () => (next ? load(next) : load()),
173
173
  };
174
174
  }
package/dist/server.d.ts CHANGED
@@ -42,6 +42,7 @@ export declare function createShapeshift(opts: ShapeshiftOptions): {
42
42
  limit?: number;
43
43
  }) => Promise<{
44
44
  entries: ActivityEntry[];
45
+ next: string | null;
45
46
  }>;
46
47
  recheck: () => Promise<{
47
48
  checked: number;
package/dist/server.js CHANGED
@@ -105,7 +105,8 @@ export function createShapeshift(opts) {
105
105
  const { tenantId = "", userId = "", op = "", args = [] } = input;
106
106
  if (!(await opts.isMember(tenantId, userId)))
107
107
  return json({ ok: false, error: "That user isn't part of that company." }, 403);
108
- const action = opts.actions[op];
108
+ // Only the product's own actions, never names every object has (like "constructor").
109
+ const action = Object.hasOwn(opts.actions, op) ? opts.actions[op] : undefined;
109
110
  if (!action)
110
111
  return json({ ok: false, error: `Unknown action: ${op}` }, 400);
111
112
  try {
package/dist/types.d.ts CHANGED
@@ -37,6 +37,7 @@ export type Draft = {
37
37
  spot: Spot;
38
38
  label: string;
39
39
  code: string;
40
+ sig?: string;
40
41
  };
41
42
  export type Preview = {
42
43
  spot: "column";
@@ -161,5 +162,7 @@ export type ActivityEntry = {
161
162
  summary: string;
162
163
  changes: string[];
163
164
  ms: number | null;
165
+ repeats: number;
166
+ since: string;
164
167
  };
165
168
  export declare const BUILT_PREFIX = "Built this add-on: ";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shapeshift-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Connect your product to Shapeshift: your customers build their own features inside it.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,7 +18,11 @@
18
18
  "default": "./dist/types.js"
19
19
  }
20
20
  },
21
- "files": ["dist", "README.md", "LICENSE"],
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
22
26
  "scripts": {
23
27
  "build": "tsc -p tsconfig.json",
24
28
  "prepublishOnly": "npm run build"