nsa-sheets-db-builder 4.0.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/LICENSE +21 -0
- package/README.md +188 -0
- package/bin/sheets-deployer.mjs +169 -0
- package/libs/alasql.js +15577 -0
- package/libs/common/gas_response_helper.ts +147 -0
- package/libs/common/gaserror.ts +101 -0
- package/libs/common/gaslogger.ts +172 -0
- package/libs/db_ddl.ts +316 -0
- package/libs/libraries.json +56 -0
- package/libs/spreadsheets_db.ts +4406 -0
- package/libs/triggers.ts +113 -0
- package/package.json +73 -0
- package/scripts/build.mjs +513 -0
- package/scripts/clean.mjs +31 -0
- package/scripts/create.mjs +94 -0
- package/scripts/ddl-handler.mjs +232 -0
- package/scripts/describe.mjs +38 -0
- package/scripts/drop.mjs +39 -0
- package/scripts/init.mjs +465 -0
- package/scripts/lib/utils.mjs +1019 -0
- package/scripts/login.mjs +102 -0
- package/scripts/provision.mjs +35 -0
- package/scripts/refresh-cache.mjs +34 -0
- package/scripts/set-key.mjs +48 -0
- package/scripts/setup-trigger.mjs +95 -0
- package/scripts/setup.mjs +677 -0
- package/scripts/show.mjs +37 -0
- package/scripts/sync.mjs +35 -0
- package/scripts/whoami.mjs +36 -0
- package/src/api/ddl-handler-entry.ts +136 -0
- package/src/api/ddl.ts +321 -0
- package/src/templates/.clasp.json.ejs +1 -0
- package/src/templates/appsscript.json.ejs +16 -0
- package/src/templates/config.ts.ejs +14 -0
- package/src/templates/ddl-handler-config.ts.ejs +3 -0
- package/src/templates/ddl-handler-main.ts.ejs +56 -0
- package/src/templates/main.ts.ejs +288 -0
- package/src/templates/rbac.ts.ejs +148 -0
- package/src/templates/views.ts.ejs +92 -0
- package/templates/blank.json +33 -0
- package/templates/blog-cms.json +507 -0
- package/templates/crm.json +360 -0
- package/templates/e-commerce.json +424 -0
- package/templates/inventory.json +307 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "e-commerce",
|
|
3
|
+
"description": "E-commerce — products, categories, customers, orders, inventory, settings",
|
|
4
|
+
"tables": {
|
|
5
|
+
"categories": {
|
|
6
|
+
"spreadsheetId": "__new__",
|
|
7
|
+
"sheetName": "categories",
|
|
8
|
+
"schema": {
|
|
9
|
+
"id": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"primaryKey": true,
|
|
12
|
+
"required": true
|
|
13
|
+
},
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"required": true
|
|
17
|
+
},
|
|
18
|
+
"slug": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"required": true
|
|
21
|
+
},
|
|
22
|
+
"description": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"parent_id": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"foreignKey": "categories.id"
|
|
28
|
+
},
|
|
29
|
+
"__audit__": {
|
|
30
|
+
"type": "object"
|
|
31
|
+
},
|
|
32
|
+
"__archived__": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"defaultValue": false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"idGenerator": "UUID",
|
|
38
|
+
"deleteMode": "soft"
|
|
39
|
+
},
|
|
40
|
+
"products": {
|
|
41
|
+
"spreadsheetId": "__new__",
|
|
42
|
+
"sheetName": "products",
|
|
43
|
+
"schema": {
|
|
44
|
+
"id": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"primaryKey": true,
|
|
47
|
+
"required": true
|
|
48
|
+
},
|
|
49
|
+
"name": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"required": true
|
|
52
|
+
},
|
|
53
|
+
"slug": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"required": true
|
|
56
|
+
},
|
|
57
|
+
"description": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"prefixed": true
|
|
60
|
+
},
|
|
61
|
+
"sku": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"price": {
|
|
65
|
+
"type": "number",
|
|
66
|
+
"required": true
|
|
67
|
+
},
|
|
68
|
+
"compare_at_price": {
|
|
69
|
+
"type": "number"
|
|
70
|
+
},
|
|
71
|
+
"currency": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"defaultValue": "USD"
|
|
74
|
+
},
|
|
75
|
+
"status": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"defaultValue": "draft"
|
|
78
|
+
},
|
|
79
|
+
"image_url": {
|
|
80
|
+
"type": "string"
|
|
81
|
+
},
|
|
82
|
+
"weight": {
|
|
83
|
+
"type": "number"
|
|
84
|
+
},
|
|
85
|
+
"weight_unit": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"defaultValue": "kg"
|
|
88
|
+
},
|
|
89
|
+
"meta_title": {
|
|
90
|
+
"type": "string"
|
|
91
|
+
},
|
|
92
|
+
"meta_description": {
|
|
93
|
+
"type": "string"
|
|
94
|
+
},
|
|
95
|
+
"__audit__": {
|
|
96
|
+
"type": "object"
|
|
97
|
+
},
|
|
98
|
+
"__archived__": {
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"defaultValue": false
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"idGenerator": "UUID",
|
|
104
|
+
"deleteMode": "soft"
|
|
105
|
+
},
|
|
106
|
+
"product_categories": {
|
|
107
|
+
"spreadsheetId": "__new__",
|
|
108
|
+
"sheetName": "product_categories",
|
|
109
|
+
"schema": {
|
|
110
|
+
"id": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"primaryKey": true,
|
|
113
|
+
"required": true
|
|
114
|
+
},
|
|
115
|
+
"product_id": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"required": true,
|
|
118
|
+
"foreignKey": "products.id"
|
|
119
|
+
},
|
|
120
|
+
"category_id": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"required": true,
|
|
123
|
+
"foreignKey": "categories.id"
|
|
124
|
+
},
|
|
125
|
+
"__audit__": {
|
|
126
|
+
"type": "object"
|
|
127
|
+
},
|
|
128
|
+
"__archived__": {
|
|
129
|
+
"type": "boolean",
|
|
130
|
+
"defaultValue": false
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"idGenerator": "UUID",
|
|
134
|
+
"deleteMode": "hard"
|
|
135
|
+
},
|
|
136
|
+
"customers": {
|
|
137
|
+
"spreadsheetId": "__new__",
|
|
138
|
+
"sheetName": "customers",
|
|
139
|
+
"schema": {
|
|
140
|
+
"id": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"primaryKey": true,
|
|
143
|
+
"required": true
|
|
144
|
+
},
|
|
145
|
+
"email": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"required": true
|
|
148
|
+
},
|
|
149
|
+
"first_name": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"required": true
|
|
152
|
+
},
|
|
153
|
+
"last_name": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"required": true
|
|
156
|
+
},
|
|
157
|
+
"phone": {
|
|
158
|
+
"type": "string"
|
|
159
|
+
},
|
|
160
|
+
"address_line1": {
|
|
161
|
+
"type": "string"
|
|
162
|
+
},
|
|
163
|
+
"address_line2": {
|
|
164
|
+
"type": "string"
|
|
165
|
+
},
|
|
166
|
+
"city": {
|
|
167
|
+
"type": "string"
|
|
168
|
+
},
|
|
169
|
+
"state": {
|
|
170
|
+
"type": "string"
|
|
171
|
+
},
|
|
172
|
+
"postal_code": {
|
|
173
|
+
"type": "string"
|
|
174
|
+
},
|
|
175
|
+
"country": {
|
|
176
|
+
"type": "string"
|
|
177
|
+
},
|
|
178
|
+
"notes": {
|
|
179
|
+
"type": "string"
|
|
180
|
+
},
|
|
181
|
+
"__audit__": {
|
|
182
|
+
"type": "object"
|
|
183
|
+
},
|
|
184
|
+
"__archived__": {
|
|
185
|
+
"type": "boolean",
|
|
186
|
+
"defaultValue": false
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"idGenerator": "UUID",
|
|
190
|
+
"deleteMode": "soft"
|
|
191
|
+
},
|
|
192
|
+
"orders": {
|
|
193
|
+
"spreadsheetId": "__new__",
|
|
194
|
+
"sheetName": "orders",
|
|
195
|
+
"schema": {
|
|
196
|
+
"id": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"primaryKey": true,
|
|
199
|
+
"required": true
|
|
200
|
+
},
|
|
201
|
+
"order_number": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"required": true
|
|
204
|
+
},
|
|
205
|
+
"customer_id": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"required": true,
|
|
208
|
+
"foreignKey": "customers.id"
|
|
209
|
+
},
|
|
210
|
+
"status": {
|
|
211
|
+
"type": "string",
|
|
212
|
+
"required": true,
|
|
213
|
+
"defaultValue": "pending"
|
|
214
|
+
},
|
|
215
|
+
"subtotal": {
|
|
216
|
+
"type": "number"
|
|
217
|
+
},
|
|
218
|
+
"tax": {
|
|
219
|
+
"type": "number"
|
|
220
|
+
},
|
|
221
|
+
"shipping": {
|
|
222
|
+
"type": "number"
|
|
223
|
+
},
|
|
224
|
+
"total": {
|
|
225
|
+
"type": "number",
|
|
226
|
+
"required": true
|
|
227
|
+
},
|
|
228
|
+
"currency": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"defaultValue": "USD"
|
|
231
|
+
},
|
|
232
|
+
"shipping_address": {
|
|
233
|
+
"type": "string"
|
|
234
|
+
},
|
|
235
|
+
"billing_address": {
|
|
236
|
+
"type": "string"
|
|
237
|
+
},
|
|
238
|
+
"notes": {
|
|
239
|
+
"type": "string"
|
|
240
|
+
},
|
|
241
|
+
"placed_at": {
|
|
242
|
+
"type": "datetime",
|
|
243
|
+
"outputFormat": "yyyy-MM-dd HH:mm:ss",
|
|
244
|
+
"timezone": "UTC"
|
|
245
|
+
},
|
|
246
|
+
"fulfilled_at": {
|
|
247
|
+
"type": "datetime",
|
|
248
|
+
"outputFormat": "yyyy-MM-dd HH:mm:ss",
|
|
249
|
+
"timezone": "UTC"
|
|
250
|
+
},
|
|
251
|
+
"__audit__": {
|
|
252
|
+
"type": "object"
|
|
253
|
+
},
|
|
254
|
+
"__archived__": {
|
|
255
|
+
"type": "boolean",
|
|
256
|
+
"defaultValue": false
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"idGenerator": "UUID",
|
|
260
|
+
"deleteMode": "soft"
|
|
261
|
+
},
|
|
262
|
+
"order_items": {
|
|
263
|
+
"spreadsheetId": "__new__",
|
|
264
|
+
"sheetName": "order_items",
|
|
265
|
+
"schema": {
|
|
266
|
+
"id": {
|
|
267
|
+
"type": "string",
|
|
268
|
+
"primaryKey": true,
|
|
269
|
+
"required": true
|
|
270
|
+
},
|
|
271
|
+
"order_id": {
|
|
272
|
+
"type": "string",
|
|
273
|
+
"required": true,
|
|
274
|
+
"foreignKey": "orders.id"
|
|
275
|
+
},
|
|
276
|
+
"product_id": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"required": true,
|
|
279
|
+
"foreignKey": "products.id"
|
|
280
|
+
},
|
|
281
|
+
"quantity": {
|
|
282
|
+
"type": "number",
|
|
283
|
+
"required": true
|
|
284
|
+
},
|
|
285
|
+
"unit_price": {
|
|
286
|
+
"type": "number",
|
|
287
|
+
"required": true
|
|
288
|
+
},
|
|
289
|
+
"total": {
|
|
290
|
+
"type": "number",
|
|
291
|
+
"required": true
|
|
292
|
+
},
|
|
293
|
+
"__audit__": {
|
|
294
|
+
"type": "object"
|
|
295
|
+
},
|
|
296
|
+
"__archived__": {
|
|
297
|
+
"type": "boolean",
|
|
298
|
+
"defaultValue": false
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"idGenerator": "UUID",
|
|
302
|
+
"deleteMode": "hard"
|
|
303
|
+
},
|
|
304
|
+
"inventory": {
|
|
305
|
+
"spreadsheetId": "__new__",
|
|
306
|
+
"sheetName": "inventory",
|
|
307
|
+
"schema": {
|
|
308
|
+
"id": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"primaryKey": true,
|
|
311
|
+
"required": true
|
|
312
|
+
},
|
|
313
|
+
"product_id": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"required": true,
|
|
316
|
+
"foreignKey": "products.id"
|
|
317
|
+
},
|
|
318
|
+
"quantity": {
|
|
319
|
+
"type": "number",
|
|
320
|
+
"required": true,
|
|
321
|
+
"defaultValue": 0
|
|
322
|
+
},
|
|
323
|
+
"low_stock_threshold": {
|
|
324
|
+
"type": "number",
|
|
325
|
+
"defaultValue": 5
|
|
326
|
+
},
|
|
327
|
+
"location": {
|
|
328
|
+
"type": "string"
|
|
329
|
+
},
|
|
330
|
+
"__audit__": {
|
|
331
|
+
"type": "object"
|
|
332
|
+
},
|
|
333
|
+
"__archived__": {
|
|
334
|
+
"type": "boolean",
|
|
335
|
+
"defaultValue": false
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"idGenerator": "UUID",
|
|
339
|
+
"deleteMode": "soft"
|
|
340
|
+
},
|
|
341
|
+
"comments": {
|
|
342
|
+
"spreadsheetId": "__new__",
|
|
343
|
+
"sheetName": "comments",
|
|
344
|
+
"schema": {
|
|
345
|
+
"id": {
|
|
346
|
+
"type": "string",
|
|
347
|
+
"primaryKey": true,
|
|
348
|
+
"required": true
|
|
349
|
+
},
|
|
350
|
+
"entity_type": {
|
|
351
|
+
"type": "string",
|
|
352
|
+
"required": true
|
|
353
|
+
},
|
|
354
|
+
"entity_id": {
|
|
355
|
+
"type": "string",
|
|
356
|
+
"required": true
|
|
357
|
+
},
|
|
358
|
+
"parent_id": {
|
|
359
|
+
"type": "string",
|
|
360
|
+
"foreignKey": "comments.id"
|
|
361
|
+
},
|
|
362
|
+
"author_name": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"required": true
|
|
365
|
+
},
|
|
366
|
+
"author_email": {
|
|
367
|
+
"type": "string"
|
|
368
|
+
},
|
|
369
|
+
"author_id": {
|
|
370
|
+
"type": "string"
|
|
371
|
+
},
|
|
372
|
+
"body": {
|
|
373
|
+
"type": "string",
|
|
374
|
+
"required": true
|
|
375
|
+
},
|
|
376
|
+
"status": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"required": true,
|
|
379
|
+
"defaultValue": "approved"
|
|
380
|
+
},
|
|
381
|
+
"__audit__": {
|
|
382
|
+
"type": "object"
|
|
383
|
+
},
|
|
384
|
+
"__archived__": {
|
|
385
|
+
"type": "boolean",
|
|
386
|
+
"defaultValue": false
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
"idGenerator": "UUID",
|
|
390
|
+
"deleteMode": "soft"
|
|
391
|
+
},
|
|
392
|
+
"settings": {
|
|
393
|
+
"spreadsheetId": "__new__",
|
|
394
|
+
"sheetName": "settings",
|
|
395
|
+
"schema": {
|
|
396
|
+
"id": {
|
|
397
|
+
"type": "string",
|
|
398
|
+
"primaryKey": true,
|
|
399
|
+
"required": true
|
|
400
|
+
},
|
|
401
|
+
"key": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"required": true
|
|
404
|
+
},
|
|
405
|
+
"value": {
|
|
406
|
+
"type": "string",
|
|
407
|
+
"prefixed": true
|
|
408
|
+
},
|
|
409
|
+
"description": {
|
|
410
|
+
"type": "string"
|
|
411
|
+
},
|
|
412
|
+
"__audit__": {
|
|
413
|
+
"type": "object"
|
|
414
|
+
},
|
|
415
|
+
"__archived__": {
|
|
416
|
+
"type": "boolean",
|
|
417
|
+
"defaultValue": false
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"idGenerator": "UUID",
|
|
421
|
+
"deleteMode": "soft"
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|