@mccaskie-labs/workbench-contacts 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/CHANGELOG.md +6 -0
- package/dist/cli.js +0 -0
- package/dist/ui.d.ts +4 -0
- package/dist/ui.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mccaskie-labs/workbench-contacts
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The owner's action helper no longer puts the database's or the settings check's own words in the answer it hands back. For `store_failed` and `bad_config` the body's `message` is now a fixed line; the full error is on the result's new `cause`, for the app's own log. The status and `error` code are unchanged.
|
|
8
|
+
|
|
3
9
|
## 0.1.0
|
|
4
10
|
|
|
5
11
|
- First version: simple customer records in the app's own database. `record()` from forms, bookings, payments, quotes, reviews and WhatsApp or Messenger messages (no SMS), matched by email, then phone, then Messenger id; search, a spreadsheet export, a person's own copy, opt-outs that stick, delete on request and a daily clean-up; the owner's Customers list and customer page with `wb-contact-*` classes; words in English, Tagalog and Taglish; `npx workbench-contacts init | generate | migration`.
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Contacts } from "./contacts.ts";
|
|
2
|
+
import { ContactsError } from "./errors.ts";
|
|
2
3
|
import type { Contact, ContactDetail, Lang, SearchResult } from "./types.ts";
|
|
3
4
|
/** The project's strings lookup: `t('ui.wbcontact.save')`. Undefined falls back to the words of `lang`. */
|
|
4
5
|
export type Words = (key: string, params?: Readonly<Record<string, string | number>>) => string | undefined;
|
|
@@ -45,6 +46,7 @@ export declare function renderContactList(r: SearchResult, o: ListOptions): stri
|
|
|
45
46
|
export declare function renderContact(c: ContactDetail, o: ContactPageOptions): string;
|
|
46
47
|
export interface ActionResult {
|
|
47
48
|
status: number;
|
|
49
|
+
/** What to answer with, as JSON. It never holds the database's or the settings check's own words. */
|
|
48
50
|
body: {
|
|
49
51
|
ok: true;
|
|
50
52
|
action: "save" | "stop_marketing" | "forget";
|
|
@@ -54,6 +56,8 @@ export interface ActionResult {
|
|
|
54
56
|
error: string;
|
|
55
57
|
message: string;
|
|
56
58
|
};
|
|
59
|
+
/** The error behind a refusal, for the app's own log. Never send it: for store_failed and bad_config its message is the database's or the settings check's. */
|
|
60
|
+
cause?: ContactsError;
|
|
57
61
|
}
|
|
58
62
|
/**
|
|
59
63
|
* The project's endpoint (behind the owner's sign-in) hands the posted form
|
package/dist/ui.js
CHANGED
|
@@ -113,7 +113,8 @@ export async function contactAction(contacts, body, account) {
|
|
|
113
113
|
catch (e) {
|
|
114
114
|
if (e instanceof ContactsError) {
|
|
115
115
|
const status = e.code === "unknown_contact" ? 404 : e.code === "taken" ? 409 : e.code === "store_failed" ? 502 : e.code === "bad_config" ? 500 : 400;
|
|
116
|
-
|
|
116
|
+
const message = e.code === "store_failed" || e.code === "bad_config" ? "contacts: it failed on the app's side (the detail is in the result's cause, for the log)" : e.message;
|
|
117
|
+
return { status, body: { ok: false, error: e.code, message }, cause: e };
|
|
117
118
|
}
|
|
118
119
|
throw e;
|
|
119
120
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mccaskie-labs/workbench-contacts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Simple customer records for Workbench apps: one list of the people a business deals with, kept in the app's own database and filled from its forms, bookings, payments, quotes, reviews and WhatsApp and Messenger messages, with search, a spreadsheet export, a person's own copy on request, opt-outs that stick, and a clean-up of people who haven't been back.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|