payload-clienthub 0.0.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.
Files changed (50) hide show
  1. package/README.md +90 -0
  2. package/dist/components/invoice-pdf.d.ts +60 -0
  3. package/dist/components/invoice-pdf.d.ts.map +1 -0
  4. package/dist/components/invoice-pdf.js +254 -0
  5. package/dist/components/invoice-pdf.js.map +1 -0
  6. package/dist/components/swiss-qr-bill.d.ts +74 -0
  7. package/dist/components/swiss-qr-bill.d.ts.map +1 -0
  8. package/dist/components/swiss-qr-bill.js +326 -0
  9. package/dist/components/swiss-qr-bill.js.map +1 -0
  10. package/dist/const.d.ts +12 -0
  11. package/dist/const.d.ts.map +1 -0
  12. package/dist/const.js +12 -0
  13. package/dist/const.js.map +1 -0
  14. package/dist/endpoints/process-all-clients.d.ts +4 -0
  15. package/dist/endpoints/process-all-clients.d.ts.map +1 -0
  16. package/dist/endpoints/process-all-clients.js +55 -0
  17. package/dist/endpoints/process-all-clients.js.map +1 -0
  18. package/dist/entities.d.ts +16 -0
  19. package/dist/entities.d.ts.map +1 -0
  20. package/dist/entities.js +425 -0
  21. package/dist/entities.js.map +1 -0
  22. package/dist/exports/client.d.ts +2 -0
  23. package/dist/exports/client.d.ts.map +1 -0
  24. package/dist/exports/client.js +2 -0
  25. package/dist/exports/client.js.map +1 -0
  26. package/dist/exports/rsc.d.ts +2 -0
  27. package/dist/exports/rsc.d.ts.map +1 -0
  28. package/dist/exports/rsc.js +2 -0
  29. package/dist/exports/rsc.js.map +1 -0
  30. package/dist/index.d.ts +14 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +38 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/payload-types.d.ts +459 -0
  35. package/dist/payload-types.d.ts.map +1 -0
  36. package/dist/translations.d.ts +183 -0
  37. package/dist/translations.d.ts.map +1 -0
  38. package/dist/translations.js +242 -0
  39. package/dist/translations.js.map +1 -0
  40. package/dist/types.d.ts +3 -0
  41. package/dist/types.d.ts.map +1 -0
  42. package/dist/utils/authentication.d.ts +3 -0
  43. package/dist/utils/authentication.d.ts.map +1 -0
  44. package/dist/utils/authentication.js +5 -0
  45. package/dist/utils/authentication.js.map +1 -0
  46. package/dist/utils/process-client-invoice.d.ts +13 -0
  47. package/dist/utils/process-client-invoice.d.ts.map +1 -0
  48. package/dist/utils/process-client-invoice.js +193 -0
  49. package/dist/utils/process-client-invoice.js.map +1 -0
  50. package/package.json +84 -0
@@ -0,0 +1,425 @@
1
+ import { createCollectionConfigFactory as t, resolveForeignKey as l } from "@repo/common";
2
+ import { SETTINGS_SLUG as d } from "./const.js";
3
+ const p = {
4
+ slug: d,
5
+ admin: {
6
+ group: "Invoicing"
7
+ },
8
+ typescript: {
9
+ interface: "PluginSettings"
10
+ },
11
+ label: "Settings",
12
+ fields: [
13
+ {
14
+ type: "tabs",
15
+ tabs: [
16
+ {
17
+ name: "company",
18
+ label: "Company Information",
19
+ fields: [
20
+ {
21
+ name: "logo",
22
+ type: "text",
23
+ admin: { description: "Company logo for invoice header" }
24
+ },
25
+ {
26
+ name: "name",
27
+ type: "text",
28
+ required: !0,
29
+ maxLength: 70
30
+ },
31
+ {
32
+ name: "address",
33
+ type: "text",
34
+ required: !0,
35
+ maxLength: 70
36
+ },
37
+ {
38
+ type: "row",
39
+ fields: [
40
+ {
41
+ name: "country",
42
+ type: "text",
43
+ required: !0,
44
+ admin: {
45
+ width: "40px",
46
+ description: "2-letters"
47
+ }
48
+ },
49
+ {
50
+ name: "zip",
51
+ label: "Postal Code",
52
+ type: "text",
53
+ required: !0,
54
+ defaultValue: "6312",
55
+ admin: {
56
+ width: "100px"
57
+ }
58
+ },
59
+ {
60
+ name: "city",
61
+ type: "text",
62
+ required: !0,
63
+ admin: {}
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ name: "website",
69
+ type: "text",
70
+ required: !0
71
+ },
72
+ {
73
+ name: "uid",
74
+ label: "UID",
75
+ type: "text",
76
+ required: !0
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ name: "contact",
82
+ label: "Contact Person",
83
+ fields: [
84
+ {
85
+ name: "name",
86
+ type: "text",
87
+ required: !0
88
+ },
89
+ {
90
+ name: "email",
91
+ type: "email",
92
+ required: !0
93
+ },
94
+ {
95
+ name: "phone",
96
+ type: "text",
97
+ required: !0
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ name: "bank",
103
+ label: "Bank Connection",
104
+ fields: [
105
+ {
106
+ name: "name",
107
+ type: "text",
108
+ required: !0
109
+ },
110
+ {
111
+ name: "iban",
112
+ label: "IBAN",
113
+ type: "text",
114
+ required: !0
115
+ },
116
+ {
117
+ name: "bic",
118
+ label: "BIC",
119
+ type: "text",
120
+ required: !0
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ }
126
+ ]
127
+ }, o = t({
128
+ admin: {
129
+ group: "Invoicing",
130
+ useAsTitle: "name"
131
+ },
132
+ fields: [
133
+ {
134
+ type: "group",
135
+ label: "Company",
136
+ fields: [
137
+ {
138
+ type: "row",
139
+ fields: [
140
+ {
141
+ name: "code",
142
+ type: "text",
143
+ required: !0,
144
+ unique: !0,
145
+ admin: {
146
+ width: "100px"
147
+ }
148
+ },
149
+ {
150
+ name: "name",
151
+ type: "text",
152
+ required: !0,
153
+ maxLength: 70
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ name: "address",
159
+ type: "text",
160
+ required: !0,
161
+ maxLength: 70
162
+ },
163
+ {
164
+ type: "row",
165
+ fields: [
166
+ {
167
+ name: "country",
168
+ type: "text",
169
+ required: !0,
170
+ defaultValue: "CH",
171
+ admin: {
172
+ description: "2-letters",
173
+ width: "40px"
174
+ }
175
+ },
176
+ {
177
+ name: "zip",
178
+ label: "Postal Code",
179
+ type: "text",
180
+ required: !0,
181
+ admin: {
182
+ width: "100px"
183
+ }
184
+ },
185
+ {
186
+ name: "city",
187
+ type: "text",
188
+ required: !0
189
+ }
190
+ ]
191
+ }
192
+ ]
193
+ },
194
+ {
195
+ name: "contact",
196
+ type: "group",
197
+ fields: [
198
+ {
199
+ type: "row",
200
+ fields: [
201
+ {
202
+ name: "salutation",
203
+ type: "select",
204
+ options: ["mr", "ms", "miss", "mx", "dr", "prof"],
205
+ required: !0,
206
+ admin: {
207
+ width: "100px"
208
+ }
209
+ },
210
+ {
211
+ name: "firstname",
212
+ type: "text",
213
+ required: !0
214
+ },
215
+ {
216
+ name: "lastname",
217
+ type: "text",
218
+ required: !0,
219
+ defaultValue: "Mustermann"
220
+ }
221
+ ]
222
+ },
223
+ {
224
+ type: "row",
225
+ fields: [
226
+ {
227
+ name: "formality",
228
+ type: "select",
229
+ options: [
230
+ { label: "Formal", value: "formal" },
231
+ { label: "Informal", value: "informal" }
232
+ ],
233
+ defaultValue: "formal",
234
+ required: !0,
235
+ admin: {
236
+ width: "140px"
237
+ }
238
+ },
239
+ {
240
+ name: "language",
241
+ type: "select",
242
+ options: [
243
+ { label: "German", value: "de" },
244
+ { label: "French", value: "fr" },
245
+ { label: "Italian", value: "it" },
246
+ { label: "English", value: "en" }
247
+ ],
248
+ defaultValue: "de",
249
+ required: !0,
250
+ admin: {
251
+ width: "140px"
252
+ }
253
+ },
254
+ {
255
+ name: "email",
256
+ type: "email",
257
+ required: !0
258
+ }
259
+ ]
260
+ }
261
+ ]
262
+ }
263
+ ]
264
+ }), s = t(({ clientsCollectionSlug: e }) => ({
265
+ admin: {
266
+ group: "Invoicing",
267
+ useAsTitle: "name"
268
+ },
269
+ fields: [
270
+ {
271
+ name: "name",
272
+ type: "text",
273
+ required: !0
274
+ },
275
+ {
276
+ name: "description",
277
+ type: "textarea"
278
+ },
279
+ {
280
+ name: "cost",
281
+ type: "number",
282
+ required: !0
283
+ },
284
+ {
285
+ name: "client",
286
+ type: "relationship",
287
+ relationTo: e,
288
+ required: !0
289
+ },
290
+ {
291
+ name: "recurrence",
292
+ type: "select",
293
+ options: [
294
+ { label: "One-time", value: "one-time" },
295
+ { label: "Monthly", value: "monthly" },
296
+ { label: "Yearly", value: "yearly" }
297
+ ],
298
+ required: !0
299
+ },
300
+ {
301
+ name: "startDate",
302
+ type: "date",
303
+ required: !0,
304
+ admin: {
305
+ date: { pickerAppearance: "dayOnly", displayFormat: "dd.MM.YYYY" }
306
+ }
307
+ },
308
+ {
309
+ name: "lastInvoicedAt",
310
+ type: "date",
311
+ admin: {
312
+ date: { pickerAppearance: "dayOnly", displayFormat: "dd.MM.YYYY" }
313
+ }
314
+ }
315
+ ]
316
+ })), y = t(
317
+ ({
318
+ invoicePdfsCollectionSlug: e,
319
+ clientsCollectionSlug: i,
320
+ servicesCollectionSlug: n
321
+ }) => ({
322
+ admin: {
323
+ group: "Invoicing",
324
+ useAsTitle: "invoiceNumber",
325
+ defaultColumns: ["invoiceNumber", "client", "date", "total", "status"]
326
+ },
327
+ access: {
328
+ create: () => !1
329
+ },
330
+ fields: [
331
+ {
332
+ name: "invoiceNumber",
333
+ type: "text",
334
+ required: !0,
335
+ unique: !0
336
+ },
337
+ {
338
+ name: "client",
339
+ type: "relationship",
340
+ relationTo: i,
341
+ required: !0
342
+ },
343
+ {
344
+ name: "items",
345
+ type: "array",
346
+ required: !0,
347
+ fields: [
348
+ {
349
+ name: "service",
350
+ type: "relationship",
351
+ relationTo: n,
352
+ required: !0
353
+ },
354
+ {
355
+ name: "cost",
356
+ type: "number",
357
+ required: !0
358
+ }
359
+ ]
360
+ },
361
+ {
362
+ name: "total",
363
+ type: "number",
364
+ required: !0
365
+ },
366
+ {
367
+ name: "date",
368
+ type: "date",
369
+ required: !0,
370
+ admin: {
371
+ date: { pickerAppearance: "dayOnly" }
372
+ }
373
+ },
374
+ {
375
+ name: "pdf",
376
+ type: "upload",
377
+ relationTo: e
378
+ },
379
+ {
380
+ name: "status",
381
+ type: "select",
382
+ options: [
383
+ { label: "Generated", value: "generated" },
384
+ { label: "Sent", value: "sent" },
385
+ { label: "Paid", value: "paid" }
386
+ ],
387
+ required: !0
388
+ },
389
+ {
390
+ name: "sentAt",
391
+ type: "date",
392
+ admin: {
393
+ date: { pickerAppearance: "dayAndTime" }
394
+ }
395
+ }
396
+ ],
397
+ hooks: {
398
+ afterDelete: [
399
+ async ({ doc: a, req: r }) => {
400
+ a?.pdf && await r.payload.delete({
401
+ collection: e,
402
+ id: l(a.pdf),
403
+ req: r
404
+ });
405
+ }
406
+ ]
407
+ }
408
+ })
409
+ ), c = t({
410
+ admin: {
411
+ hidden: !0
412
+ },
413
+ upload: {
414
+ mimeTypes: ["application/pdf"]
415
+ },
416
+ fields: []
417
+ });
418
+ export {
419
+ o as Clients,
420
+ c as InvoicePdfs,
421
+ y as Invoices,
422
+ s as Services,
423
+ p as Settings
424
+ };
425
+ //# sourceMappingURL=entities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.js","sources":["../src/entities.ts"],"sourcesContent":["import { createCollectionConfigFactory, resolveForeignKey } from '@repo/common';\nimport type { GlobalConfig } from 'payload';\nimport { SETTINGS_SLUG } from './const';\nimport type { ResolvedPluginOptions } from './types';\n\nexport const Settings: GlobalConfig = {\n slug: SETTINGS_SLUG,\n admin: {\n group: 'Invoicing',\n },\n typescript: {\n interface: 'PluginSettings',\n },\n label: 'Settings',\n fields: [\n {\n type: 'tabs',\n tabs: [\n {\n name: 'company',\n label: 'Company Information',\n fields: [\n {\n name: 'logo',\n type: 'text',\n admin: { description: 'Company logo for invoice header' },\n },\n\n {\n name: 'name',\n type: 'text',\n required: true,\n maxLength: 70,\n },\n {\n name: 'address',\n type: 'text',\n required: true,\n maxLength: 70,\n },\n {\n type: 'row',\n fields: [\n {\n name: 'country',\n type: 'text',\n required: true,\n admin: {\n width: '40px',\n description: '2-letters',\n },\n },\n {\n name: 'zip',\n label: 'Postal Code',\n type: 'text',\n required: true,\n defaultValue: '6312',\n admin: {\n width: '100px',\n },\n },\n {\n name: 'city',\n type: 'text',\n required: true,\n admin: {},\n },\n ],\n },\n\n {\n name: 'website',\n type: 'text',\n required: true,\n },\n {\n name: 'uid',\n label: 'UID',\n type: 'text',\n required: true,\n },\n ],\n },\n\n {\n name: 'contact',\n label: 'Contact Person',\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n },\n {\n name: 'email',\n type: 'email',\n required: true,\n },\n {\n name: 'phone',\n type: 'text',\n required: true,\n },\n ],\n },\n {\n name: 'bank',\n label: 'Bank Connection',\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n },\n {\n name: 'iban',\n label: 'IBAN',\n type: 'text',\n required: true,\n },\n {\n name: 'bic',\n label: 'BIC',\n type: 'text',\n required: true,\n },\n ],\n },\n ],\n },\n ],\n};\n\n// MARK: Collections\n\nexport const Clients = createCollectionConfigFactory({\n admin: {\n group: 'Invoicing',\n useAsTitle: 'name',\n },\n fields: [\n {\n type: 'group',\n label: 'Company',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'code',\n type: 'text',\n required: true,\n unique: true,\n admin: {\n width: '100px',\n },\n },\n {\n name: 'name',\n type: 'text',\n required: true,\n maxLength: 70,\n },\n ],\n },\n\n {\n name: 'address',\n type: 'text',\n required: true,\n maxLength: 70,\n },\n\n {\n type: 'row',\n fields: [\n {\n name: 'country',\n type: 'text',\n required: true,\n defaultValue: 'CH',\n admin: {\n description: '2-letters',\n width: '40px',\n },\n },\n {\n name: 'zip',\n label: 'Postal Code',\n type: 'text',\n required: true,\n admin: {\n width: '100px',\n },\n },\n {\n name: 'city',\n type: 'text',\n required: true,\n },\n ],\n },\n ],\n },\n\n {\n name: 'contact',\n type: 'group',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'salutation',\n type: 'select',\n options: ['mr', 'ms', 'miss', 'mx', 'dr', 'prof'],\n required: true,\n admin: {\n width: '100px',\n },\n },\n {\n name: 'firstname',\n type: 'text',\n required: true,\n },\n {\n name: 'lastname',\n type: 'text',\n required: true,\n defaultValue: 'Mustermann',\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'formality',\n type: 'select',\n options: [\n { label: 'Formal', value: 'formal' },\n { label: 'Informal', value: 'informal' },\n ],\n defaultValue: 'formal',\n required: true,\n admin: {\n width: '140px',\n },\n },\n {\n name: 'language',\n type: 'select',\n options: [\n { label: 'German', value: 'de' },\n { label: 'French', value: 'fr' },\n { label: 'Italian', value: 'it' },\n { label: 'English', value: 'en' },\n ],\n defaultValue: 'de',\n required: true,\n admin: {\n width: '140px',\n },\n },\n {\n name: 'email',\n type: 'email',\n required: true,\n },\n ],\n },\n ],\n },\n ],\n});\n\nexport const Services = createCollectionConfigFactory<\n ResolvedPluginOptions<'clientsCollectionSlug'>\n>(({ clientsCollectionSlug }) => ({\n admin: {\n group: 'Invoicing',\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n },\n {\n name: 'description',\n type: 'textarea',\n },\n {\n name: 'cost',\n type: 'number',\n required: true,\n },\n {\n name: 'client',\n type: 'relationship',\n relationTo: clientsCollectionSlug,\n required: true,\n },\n {\n name: 'recurrence',\n type: 'select',\n options: [\n { label: 'One-time', value: 'one-time' },\n { label: 'Monthly', value: 'monthly' },\n { label: 'Yearly', value: 'yearly' },\n ],\n required: true,\n },\n {\n name: 'startDate',\n type: 'date',\n required: true,\n admin: {\n date: { pickerAppearance: 'dayOnly', displayFormat: 'dd.MM.YYYY' },\n },\n },\n {\n name: 'lastInvoicedAt',\n type: 'date',\n admin: {\n date: { pickerAppearance: 'dayOnly', displayFormat: 'dd.MM.YYYY' },\n },\n },\n ],\n}));\n\nexport const Invoices = createCollectionConfigFactory<\n ResolvedPluginOptions<\n | 'invoicePdfsCollectionSlug'\n | 'clientsCollectionSlug'\n | 'servicesCollectionSlug'\n >\n>(\n ({\n invoicePdfsCollectionSlug,\n clientsCollectionSlug,\n servicesCollectionSlug,\n }) => ({\n admin: {\n group: 'Invoicing',\n useAsTitle: 'invoiceNumber',\n defaultColumns: ['invoiceNumber', 'client', 'date', 'total', 'status'],\n },\n access: {\n create: () => false,\n },\n fields: [\n {\n name: 'invoiceNumber',\n type: 'text',\n required: true,\n unique: true,\n },\n {\n name: 'client',\n type: 'relationship',\n relationTo: clientsCollectionSlug,\n required: true,\n },\n {\n name: 'items',\n type: 'array',\n required: true,\n fields: [\n {\n name: 'service',\n type: 'relationship',\n relationTo: servicesCollectionSlug,\n required: true,\n },\n {\n name: 'cost',\n type: 'number',\n required: true,\n },\n ],\n },\n {\n name: 'total',\n type: 'number',\n required: true,\n },\n {\n name: 'date',\n type: 'date',\n required: true,\n admin: {\n date: { pickerAppearance: 'dayOnly' },\n },\n },\n {\n name: 'pdf',\n type: 'upload',\n relationTo: invoicePdfsCollectionSlug,\n },\n {\n name: 'status',\n type: 'select',\n options: [\n { label: 'Generated', value: 'generated' },\n { label: 'Sent', value: 'sent' },\n { label: 'Paid', value: 'paid' },\n ],\n required: true,\n },\n {\n name: 'sentAt',\n type: 'date',\n admin: {\n date: { pickerAppearance: 'dayAndTime' },\n },\n },\n ],\n hooks: {\n afterDelete: [\n async ({ doc, req }) => {\n if (!doc?.pdf) return;\n\n await req.payload.delete({\n collection: invoicePdfsCollectionSlug,\n id: resolveForeignKey(doc.pdf),\n req,\n });\n },\n ],\n },\n }),\n);\n\nexport const InvoicePdfs = createCollectionConfigFactory({\n admin: {\n hidden: true,\n },\n upload: {\n mimeTypes: ['application/pdf'],\n },\n fields: [],\n});\n"],"names":["Settings","SETTINGS_SLUG","Clients","createCollectionConfigFactory","Services","clientsCollectionSlug","Invoices","invoicePdfsCollectionSlug","servicesCollectionSlug","doc","req","resolveForeignKey","InvoicePdfs"],"mappings":";;AAKO,MAAMA,IAAyB;AAAA,EACpC,MAAMC;AAAA,EACN,OAAO;AAAA,IACL,OAAO;AAAA,EAAA;AAAA,EAET,YAAY;AAAA,IACV,WAAW;AAAA,EAAA;AAAA,EAEb,OAAO;AAAA,EACP,QAAQ;AAAA,IACN;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,QACJ;AAAA,UACE,MAAM;AAAA,UACN,OAAO;AAAA,UACP,QAAQ;AAAA,YACN;AAAA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,QAEjC,UAAU;AAAA,MAAA;AAAA,MAEZ;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,UACL,MAAM,EAAE,kBAAkB,aAAA;AAAA,QAAa;AAAA,MACzC;AAAA,IACF;AAAA,IAEF,OAAO;AAAA,MACL,aAAa;AAAA,QACX,OAAO,EAAE,KAAAE,GAAK,KAAAC,QAAU;AACtB,UAAKD,GAAK,OAEV,MAAMC,EAAI,QAAQ,OAAO;AAAA,YACvB,YAAYH;AAAA,YACZ,IAAII,EAAkBF,EAAI,GAAG;AAAA,YAC7B,KAAAC;AAAA,UAAA,CACD;AAAA,QACH;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ,GAEaE,IAAcT,EAA8B;AAAA,EACvD,OAAO;AAAA,IACL,QAAQ;AAAA,EAAA;AAAA,EAEV,QAAQ;AAAA,IACN,WAAW,CAAC,iBAAiB;AAAA,EAAA;AAAA,EAE/B,QAAQ,CAAA;AACV,CAAC;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rsc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../src/exports/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=rsc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rsc.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { CollectionSlug, Plugin } from 'payload';
2
+ export interface ClienthubPluginOptions {
3
+ cronSecret: string;
4
+ clientsCollectionSlug: CollectionSlug;
5
+ servicesCollectionSlug: CollectionSlug;
6
+ invoicesCollectionSlug: CollectionSlug;
7
+ invoicePdfsCollectionSlug: CollectionSlug;
8
+ onError?: (error: Error, context: {
9
+ operation: string;
10
+ metadata?: Record<string, unknown>;
11
+ }) => void;
12
+ }
13
+ export declare const clienthubPlugin: ({ cronSecret, clientsCollectionSlug, servicesCollectionSlug, invoicesCollectionSlug, invoicePdfsCollectionSlug, onError, }: ClienthubPluginOptions) => Plugin;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAMtD,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,EAAE,cAAc,CAAC;IACtC,sBAAsB,EAAE,cAAc,CAAC;IACvC,sBAAsB,EAAE,cAAc,CAAC;IACvC,yBAAyB,EAAE,cAAc,CAAC;IAC1C,OAAO,CAAC,EAAE,CACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAC/D,IAAI,CAAC;CACX;AAED,eAAO,MAAM,eAAe,+HAQvB,sBAAsB,KAAG,MAuC3B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import { deepMerge as a } from "payload";
2
+ import { createProcessAllClientsEndpoint as i } from "./endpoints/process-all-clients.js";
3
+ import { Settings as l, Clients as m, Services as h, InvoicePdfs as u, Invoices as d } from "./entities.js";
4
+ import { invoiceTranslations as v } from "./translations.js";
5
+ const A = ({
6
+ cronSecret: p,
7
+ clientsCollectionSlug: r = "clients",
8
+ servicesCollectionSlug: e = "services",
9
+ invoicesCollectionSlug: n = "invoices",
10
+ invoicePdfsCollectionSlug: t = "invoice-pdfs",
11
+ onError: o = console.error
12
+ }) => (s) => (s.globals ??= [], s.globals.push(l), s.collections ??= [], s.collections.push(m({ slug: r })), s.collections.push(
13
+ h({ slug: e, clientsCollectionSlug: r })
14
+ ), s.collections.push(u({ slug: t })), s.collections.push(
15
+ d({
16
+ slug: n,
17
+ invoicePdfsCollectionSlug: t,
18
+ clientsCollectionSlug: r,
19
+ servicesCollectionSlug: e
20
+ })
21
+ ), s.endpoints ??= [], s.endpoints.push(
22
+ i({
23
+ cronSecret: p,
24
+ clientsCollectionSlug: r,
25
+ servicesCollectionSlug: e,
26
+ onError: o
27
+ })
28
+ ), s.i18n = {
29
+ ...s.i18n,
30
+ translations: a(
31
+ s.i18n?.translations || {},
32
+ v
33
+ )
34
+ }, s);
35
+ export {
36
+ A as clienthubPlugin
37
+ };
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { CollectionSlug, Plugin } from 'payload';\nimport { deepMerge } from 'payload';\nimport { createProcessAllClientsEndpoint } from '@/endpoints/process-all-clients';\nimport { Clients, InvoicePdfs, Invoices, Services, Settings } from '@/entities';\nimport { invoiceTranslations } from '@/translations';\n\nexport interface ClienthubPluginOptions {\n cronSecret: string;\n clientsCollectionSlug: CollectionSlug;\n servicesCollectionSlug: CollectionSlug;\n invoicesCollectionSlug: CollectionSlug;\n invoicePdfsCollectionSlug: CollectionSlug;\n onError?: (\n error: Error,\n context: { operation: string; metadata?: Record<string, unknown> },\n ) => void;\n}\n\nexport const clienthubPlugin =\n ({\n cronSecret,\n clientsCollectionSlug = 'clients',\n servicesCollectionSlug = 'services',\n invoicesCollectionSlug = 'invoices',\n invoicePdfsCollectionSlug = 'invoice-pdfs',\n onError = console.error,\n }: ClienthubPluginOptions): Plugin =>\n (config) => {\n config.globals ??= [];\n config.globals.push(Settings);\n\n config.collections ??= [];\n config.collections.push(Clients({ slug: clientsCollectionSlug }));\n config.collections.push(\n Services({ slug: servicesCollectionSlug, clientsCollectionSlug }),\n );\n config.collections.push(InvoicePdfs({ slug: invoicePdfsCollectionSlug }));\n config.collections.push(\n Invoices({\n slug: invoicesCollectionSlug,\n invoicePdfsCollectionSlug,\n clientsCollectionSlug,\n servicesCollectionSlug,\n }),\n );\n\n config.endpoints ??= [];\n config.endpoints.push(\n createProcessAllClientsEndpoint({\n cronSecret,\n clientsCollectionSlug,\n servicesCollectionSlug,\n onError,\n }),\n );\n\n config.i18n = {\n ...config.i18n,\n translations: deepMerge(\n config.i18n?.translations || {},\n invoiceTranslations,\n ),\n };\n\n return config;\n };\n"],"names":["clienthubPlugin","cronSecret","clientsCollectionSlug","servicesCollectionSlug","invoicesCollectionSlug","invoicePdfsCollectionSlug","onError","config","Settings","Clients","Services","InvoicePdfs","Invoices","createProcessAllClientsEndpoint","deepMerge","invoiceTranslations"],"mappings":";;;;AAkBO,MAAMA,IACX,CAAC;AAAA,EACC,YAAAC;AAAA,EACA,uBAAAC,IAAwB;AAAA,EACxB,wBAAAC,IAAyB;AAAA,EACzB,wBAAAC,IAAyB;AAAA,EACzB,2BAAAC,IAA4B;AAAA,EAC5B,SAAAC,IAAU,QAAQ;AACpB,MACA,CAACC,OACCA,EAAO,YAAY,CAAA,GACnBA,EAAO,QAAQ,KAAKC,CAAQ,GAE5BD,EAAO,gBAAgB,CAAA,GACvBA,EAAO,YAAY,KAAKE,EAAQ,EAAE,MAAMP,EAAA,CAAuB,CAAC,GAChEK,EAAO,YAAY;AAAA,EACjBG,EAAS,EAAE,MAAMP,GAAwB,uBAAAD,GAAuB;AAAA,GAElEK,EAAO,YAAY,KAAKI,EAAY,EAAE,MAAMN,EAAA,CAA2B,CAAC,GACxEE,EAAO,YAAY;AAAA,EACjBK,EAAS;AAAA,IACP,MAAMR;AAAA,IACN,2BAAAC;AAAA,IACA,uBAAAH;AAAA,IACA,wBAAAC;AAAA,EAAA,CACD;AAAA,GAGHI,EAAO,cAAc,CAAA,GACrBA,EAAO,UAAU;AAAA,EACfM,EAAgC;AAAA,IAC9B,YAAAZ;AAAA,IACA,uBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,SAAAG;AAAA,EAAA,CACD;AAAA,GAGHC,EAAO,OAAO;AAAA,EACZ,GAAGA,EAAO;AAAA,EACV,cAAcO;AAAA,IACZP,EAAO,MAAM,gBAAgB,CAAA;AAAA,IAC7BQ;AAAA,EAAA;AACF,GAGKR;"}