@pacp/spec 1.0.0 → 1.0.2
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/README.md +11 -11
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/pacp.schema.json +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# pacp
|
|
1
|
+
# @pacp/spec
|
|
2
2
|
|
|
3
3
|
Schema, profiles e validador do [PACP](https://pacp-org.github.io/pacp/) (Padrão Aberto de Catálogo e Precificação) como pacote npm.
|
|
4
4
|
|
|
5
5
|
## Instalação
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install pacp
|
|
8
|
+
npm install @pacp/spec
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Para usar a função `validate()`, instale também as peer dependencies:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install pacp ajv ajv-formats
|
|
14
|
+
npm install @pacp/spec ajv ajv-formats
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Uso
|
|
@@ -19,7 +19,7 @@ npm install pacp ajv ajv-formats
|
|
|
19
19
|
### Schema e profiles (sem dependências extras)
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import { schema, profiles, profileIds, SPEC_VERSION } from 'pacp';
|
|
22
|
+
import { schema, profiles, profileIds, SPEC_VERSION } from '@pacp/spec';
|
|
23
23
|
|
|
24
24
|
// JSON Schema completo do PACP v1.0.0
|
|
25
25
|
console.log(schema.$id); // "https://pacp.dev/spec/1.0.0/pacp.schema.json"
|
|
@@ -37,7 +37,7 @@ console.log(profiles.moveis.title); // "PACP Profile: Moveis e Alta Decoracao"
|
|
|
37
37
|
### Validação de documentos
|
|
38
38
|
|
|
39
39
|
```typescript
|
|
40
|
-
import { validate } from 'pacp';
|
|
40
|
+
import { validate } from '@pacp/spec';
|
|
41
41
|
|
|
42
42
|
const catalogDocument = {
|
|
43
43
|
spec: '1.0.0',
|
|
@@ -84,7 +84,7 @@ import type {
|
|
|
84
84
|
Measure,
|
|
85
85
|
DimensionsObj,
|
|
86
86
|
ValidationResult,
|
|
87
|
-
} from 'pacp';
|
|
87
|
+
} from '@pacp/spec';
|
|
88
88
|
|
|
89
89
|
const product: Product = {
|
|
90
90
|
id: 'prod_mesa',
|
|
@@ -109,13 +109,13 @@ Se preferir usar os JSONs diretamente (sem TypeScript):
|
|
|
109
109
|
|
|
110
110
|
```javascript
|
|
111
111
|
// Schema principal
|
|
112
|
-
const schema = require('pacp/schema.json');
|
|
112
|
+
const schema = require('@pacp/spec/schema.json');
|
|
113
113
|
|
|
114
114
|
// Profiles
|
|
115
|
-
const moveis = require('pacp/profiles/moveis.json');
|
|
116
|
-
const iluminacao = require('pacp/profiles/iluminacao.json');
|
|
117
|
-
const pisos = require('pacp/profiles/pisos-revestimentos.json');
|
|
118
|
-
const fiscal = require('pacp/profiles/fiscal-br.json');
|
|
115
|
+
const moveis = require('@pacp/spec/profiles/moveis.json');
|
|
116
|
+
const iluminacao = require('@pacp/spec/profiles/iluminacao.json');
|
|
117
|
+
const pisos = require('@pacp/spec/profiles/pisos-revestimentos.json');
|
|
118
|
+
const fiscal = require('@pacp/spec/profiles/fiscal-br.json');
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
## O que está incluído
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/pacp.schema.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pacp/spec@latest/dist/pacp.schema.json",
|
|
4
4
|
"title": "PACP v1.0.0",
|
|
5
5
|
"oneOf": [
|
|
6
6
|
{
|
|
@@ -230,6 +230,7 @@
|
|
|
230
230
|
"category": { "type": "string", "minLength": 1 },
|
|
231
231
|
"gtin": { "type": "string", "pattern": "^\\d{8,14}$" },
|
|
232
232
|
"base_price": { "type": "number" },
|
|
233
|
+
"unit": { "type": "string", "minLength": 1 },
|
|
233
234
|
"images": {
|
|
234
235
|
"type": "array",
|
|
235
236
|
"items": { "$ref": "#/$defs/imageRef" }
|
package/package.json
CHANGED