Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
This commit is contained in:
commit
b4150c8250
1364 changed files with 6814366 additions and 0 deletions
66
vendor/zapier-platform/example-apps/line-items/.gitignore
vendored
Normal file
66
vendor/zapier-platform/example-apps/line-items/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/
|
||||
dist/
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Typescript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# environment variables file
|
||||
.env
|
||||
.environment
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
.pnpm-store/
|
||||
51
vendor/zapier-platform/example-apps/line-items/README.md
vendored
Normal file
51
vendor/zapier-platform/example-apps/line-items/README.md
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# line-items
|
||||
|
||||
This Zapier integration project is generated by the `zapier-platform init` CLI command.
|
||||
|
||||
These are what you normally do next:
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install --ignore-scripts # or you can use pnpm or yarn
|
||||
|
||||
# Run tests
|
||||
zapier-platform test
|
||||
|
||||
# Register the integration on Zapier if you haven't
|
||||
zapier-platform register "App Title"
|
||||
|
||||
# Or you can link to an existing integration on Zapier
|
||||
zapier-platform link
|
||||
|
||||
# Push it to Zapier
|
||||
zapier-platform push
|
||||
```
|
||||
|
||||
Then, to add more features, you can use the `zapier-platform scaffold` command, for example:
|
||||
|
||||
```bash
|
||||
# Add a trigger
|
||||
zapier-platform scaffold trigger contact
|
||||
|
||||
# Add an action
|
||||
zapier-platform scaffold create contact
|
||||
```
|
||||
|
||||
Find out more on the latest docs: https://docs.zapier.com/platform
|
||||
|
||||
# line-items
|
||||
|
||||
An example integration demonstrating line item support. Line items are fields
|
||||
with a `children` property that represent structured, repeating data — like rows
|
||||
in a spreadsheet or items in an order.
|
||||
|
||||
## Testing with `zapier-platform invoke`
|
||||
|
||||
```bash
|
||||
# Non-interactive with JSON input
|
||||
zapier-platform invoke create order --non-interactive \
|
||||
-i '{"name": "My Order", "line_items": [{"product_name": "Pens", "quantity": "12", "price": "1.50"}]}'
|
||||
|
||||
# Interactive mode — use the line item editing UI
|
||||
zapier-platform invoke create order -i '{"name": "My Order"}'
|
||||
```
|
||||
67
vendor/zapier-platform/example-apps/line-items/creates/order.js
vendored
Normal file
67
vendor/zapier-platform/example-apps/line-items/creates/order.js
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
const perform = async (z, bundle) => {
|
||||
const response = await z.request({
|
||||
url: 'https://httpbin.zapier-tooling.com/post',
|
||||
method: 'POST',
|
||||
body: {
|
||||
name: bundle.inputData.name,
|
||||
line_items: bundle.inputData.line_items,
|
||||
},
|
||||
});
|
||||
|
||||
return response.data;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
key: 'order',
|
||||
noun: 'Order',
|
||||
display: {
|
||||
label: 'Create Order',
|
||||
description: 'Creates a new order with line items.',
|
||||
},
|
||||
operation: {
|
||||
inputFields: [
|
||||
{ key: 'name', required: true, type: 'string', label: 'Order Name' },
|
||||
{
|
||||
key: 'line_items',
|
||||
label: 'Line Items',
|
||||
children: [
|
||||
{
|
||||
key: 'product_name',
|
||||
type: 'string',
|
||||
label: 'Product Name',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: 'quantity',
|
||||
type: 'integer',
|
||||
label: 'Quantity',
|
||||
required: true,
|
||||
},
|
||||
{ key: 'price', type: 'number', label: 'Unit Price' },
|
||||
],
|
||||
},
|
||||
],
|
||||
perform,
|
||||
sample: {
|
||||
id: 1,
|
||||
name: 'Stationery Order',
|
||||
line_items: [
|
||||
{ product_name: 'Pens', quantity: 12, price: 1.5 },
|
||||
{ product_name: 'Notebooks', quantity: 3, price: 8.99 },
|
||||
],
|
||||
},
|
||||
outputFields: [
|
||||
{ key: 'id', label: 'ID' },
|
||||
{ key: 'name', label: 'Order Name' },
|
||||
{
|
||||
key: 'line_items',
|
||||
label: 'Line Items',
|
||||
children: [
|
||||
{ key: 'product_name', label: 'Product Name' },
|
||||
{ key: 'quantity', label: 'Quantity' },
|
||||
{ key: 'price', label: 'Unit Price' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
12
vendor/zapier-platform/example-apps/line-items/index.js
vendored
Normal file
12
vendor/zapier-platform/example-apps/line-items/index.js
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
const order = require('./creates/order');
|
||||
|
||||
const App = {
|
||||
version: require('./package.json').version,
|
||||
platformVersion: require('zapier-platform-core').version,
|
||||
|
||||
creates: {
|
||||
[order.key]: order,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = App;
|
||||
16
vendor/zapier-platform/example-apps/line-items/package.json
vendored
Normal file
16
vendor/zapier-platform/example-apps/line-items/package.json
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "line-items",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"test": "jest --testTimeout 10000"
|
||||
},
|
||||
"dependencies": {
|
||||
"zapier-platform-core": "19.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^29.6.0"
|
||||
},
|
||||
"private": true,
|
||||
"main": "index.js"
|
||||
}
|
||||
30
vendor/zapier-platform/example-apps/line-items/test/creates.test.js
vendored
Normal file
30
vendor/zapier-platform/example-apps/line-items/test/creates.test.js
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* globals describe, expect, test */
|
||||
|
||||
const zapier = require('zapier-platform-core');
|
||||
|
||||
const App = require('../index');
|
||||
const appTester = zapier.createAppTester(App);
|
||||
zapier.tools.env.inject();
|
||||
|
||||
describe('creates', () => {
|
||||
test('create order with line items', async () => {
|
||||
const bundle = {
|
||||
inputData: {
|
||||
name: 'Test Order',
|
||||
line_items: [
|
||||
{ product_name: 'Pens', quantity: 12, price: 1.5 },
|
||||
{ product_name: 'Notebooks', quantity: 3, price: 8.99 },
|
||||
],
|
||||
},
|
||||
};
|
||||
const result = await appTester(
|
||||
App.creates.order.operation.perform,
|
||||
bundle,
|
||||
);
|
||||
const body = JSON.parse(result.data);
|
||||
expect(body.name).toBe('Test Order');
|
||||
expect(body.line_items).toHaveLength(2);
|
||||
expect(body.line_items[0].product_name).toBe('Pens');
|
||||
expect(body.line_items[1].quantity).toBe(3);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue